OSGVertexProgramChunk.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include <cstdlib>
00044 #include <cstdio>
00045
00046 #include <boost/bind.hpp>
00047
00048 #include <OSGConfig.h>
00049
00050 #include <OSGGL.h>
00051 #include <OSGGLEXT.h>
00052
00053 #include "OSGWindow.h"
00054
00055 #include "OSGVertexProgramChunk.h"
00056
00057 OSG_USING_NAMESPACE
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 StateChunkClass VertexProgramChunk::_class("VertexProgram");
00069
00070 UInt32 VertexProgramChunk::_arbVertexProgram = Window::invalidExtensionID;
00071
00072
00073
00074
00075
00076 void VertexProgramChunk::initMethod(InitPhase ePhase)
00077 {
00078 if(ePhase == TypeObject::SystemPost)
00079 {
00080 _arbVertexProgram = Window::registerExtension("GL_ARB_vertex_program");
00081 }
00082 }
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 VertexProgramChunk::VertexProgramChunk(void) :
00096 Inherited()
00097 {
00098 }
00099
00100 VertexProgramChunk::VertexProgramChunk(const VertexProgramChunk &source) :
00101 Inherited(source)
00102 {
00103 }
00104
00105 VertexProgramChunk::~VertexProgramChunk(void)
00106 {
00107 }
00108
00109
00110
00111 void VertexProgramChunk::onCreate(const VertexProgramChunk *chunk)
00112 {
00113 Inherited::onCreate(chunk);
00114
00115 if(GlobalSystemState == Startup)
00116 return;
00117
00118 setGLId(Window::registerGLObject(
00119 boost::bind(&VertexProgramChunk::handleGL, this,
00120 _1, _2, _3),
00121 boost::bind(&VertexProgramChunk::handleDestroyGL, this,
00122 _1, _2, _3)
00123 ));
00124 }
00125
00126
00127
00128
00129 const StateChunkClass *VertexProgramChunk::getClass(void) const
00130 {
00131 return &_class;
00132 }
00133
00134
00135
00136 void VertexProgramChunk::changed(ConstFieldMaskArg whichField,
00137 UInt32 origin,
00138 BitVector details)
00139 {
00140 Inherited::changed(whichField, origin, details);
00141 }
00142
00143 void VertexProgramChunk::dump( UInt32 ,
00144 const BitVector ) const
00145 {
00146 SLOG << "Dump VertexProgramChunk NI" << std::endl;
00147 }
00148
00149
00150
00151 UInt32 VertexProgramChunk::getExtension(void) const
00152 {
00153 return _arbVertexProgram;
00154 }
00155
00156 GLenum VertexProgramChunk::getTarget(void) const
00157 {
00158 return GL_VERTEX_PROGRAM_ARB;
00159 }
00160
00161 const char *VertexProgramChunk::getTargetName(void) const
00162 {
00163 return "Vertex Program";
00164 }
00165
00166
00167 void VertexProgramChunk::handleGL(DrawEnv *pEnv,
00168 UInt32 osgid,
00169 Window::GLObjectStatusE mode)
00170 {
00171 Inherited::handleGL(pEnv,
00172 osgid,
00173 mode,
00174 GL_VERTEX_PROGRAM_ARB,
00175 _arbVertexProgram);
00176 }
00177
00178 void VertexProgramChunk::handleDestroyGL(DrawEnv *pEnv,
00179 UInt32 osgid,
00180 Window::GLObjectStatusE mode)
00181 {
00182 Inherited::handleDestroyGL(pEnv,
00183 osgid,
00184 mode,
00185 GL_VERTEX_PROGRAM_ARB,
00186 _arbVertexProgram);
00187 }