Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGVertexProgramChunk.cpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *               Copyright (C) 2000-2002 by the OpenSG Forum                 *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 //---------------------------------------------------------------------------
00040 //  Includes
00041 //---------------------------------------------------------------------------
00042 
00043 #include <stdlib.h>
00044 #include <stdio.h>
00045 
00046 #include <OSGConfig.h>
00047 
00048 #include <OSGGL.h>
00049 #include <OSGGLEXT.h>
00050 
00051 #include "OSGWindow.h"
00052 
00053 #include "OSGVertexProgramChunk.h"
00054 
00055 OSG_USING_NAMESPACE
00056 
00067 /***************************************************************************\
00068  *                           Class variables                               *
00069 \***************************************************************************/
00070 
00071 StateChunkClass VertexProgramChunk::_class("VertexProgram");
00072 
00073 UInt32 VertexProgramChunk::_arbVertexProgram;
00074 
00075 /***************************************************************************\
00076  *                           Class methods                                 *
00077 \***************************************************************************/
00078 
00079 void VertexProgramChunk::initMethod (void)
00080 {
00081 }
00082 
00083 
00084 /***************************************************************************\
00085  *                           Instance methods                              *
00086 \***************************************************************************/
00087 
00088 /*-------------------------------------------------------------------------*\
00089  -  private                                                                 -
00090 \*-------------------------------------------------------------------------*/
00091 
00092 /*----------------------- constructors & destructors ----------------------*/
00093 
00094 VertexProgramChunk::VertexProgramChunk(void) :
00095     Inherited()
00096 {
00097     _arbVertexProgram = Window::registerExtension("GL_ARB_vertex_program");
00098 }
00099 
00100 VertexProgramChunk::VertexProgramChunk(const VertexProgramChunk &source) :
00101     Inherited(source)
00102 {
00103 }
00104 
00105 VertexProgramChunk::~VertexProgramChunk(void)
00106 {
00107 }
00108 
00109 /*----------------------------- onCreate --------------------------------*/
00110 
00111 void VertexProgramChunk::onCreate(const VertexProgramChunk *)
00112 {
00113     if(GlobalSystemState == Startup)
00114         return;
00115 
00116     // !!! this temporary is needed to work around compiler problems (sgi)
00117     // CHECK CHECK
00118     //  VertexProgramChunkPtr tmpPtr = FieldContainer::getPtr<ProgramChunkPtr>(*this);
00119     VertexProgramChunkPtr tmpPtr(*this);
00120 
00121     beginEditCP(tmpPtr, VertexProgramChunk::GLIdFieldMask);
00122 
00123     setGLId(
00124         Window::registerGLObject(
00125             osgTypedMethodVoidFunctor2ObjCPtrPtr<VertexProgramChunkPtr, 
00126                                                  Window , 
00127                                                  UInt32>(
00128                                                      tmpPtr, 
00129                                                      &VertexProgramChunk::handleGL),
00130             1));
00131 
00132     endEditCP(tmpPtr, VertexProgramChunk::GLIdFieldMask);
00133 }
00134 
00135 
00136 /*------------------------- Chunk Class Access ---------------------------*/
00137 
00138 const StateChunkClass *VertexProgramChunk::getClass(void) const
00139 {
00140     return &_class;
00141 }
00142 
00143 /*----------------------------- class specific ----------------------------*/
00144 
00145 void VertexProgramChunk::changed(BitVector whichField, UInt32 origin)
00146 {
00147     Inherited::changed(whichField, origin);
00148 }
00149 
00150 void VertexProgramChunk::dump(      UInt32    , 
00151                          const BitVector ) const
00152 {
00153     SLOG << "Dump VertexProgramChunk NI" << std::endl;
00154 }
00155 
00156 /*------------------------------ State ------------------------------------*/
00157 
00161 void VertexProgramChunk::handleGL(Window *win, UInt32 idstatus)
00162 {
00163     Inherited::handleGL(win, idstatus, GL_VERTEX_PROGRAM_ARB, _arbVertexProgram);
00164 }
00165 
00166 UInt32 VertexProgramChunk::getExtension(void) const
00167 {
00168     return _arbVertexProgram;
00169 }
00170 
00171 GLenum VertexProgramChunk::getTarget(void) const
00172 {
00173     return GL_VERTEX_PROGRAM_ARB;
00174 }
00175 
00176 const char *VertexProgramChunk::getTargetName(void) const
00177 {
00178     return "Vertex Program";
00179 }
00180 
00181 
00182 /*------------------------------------------------------------------------*/
00183 /*                              cvs id's                                  */
00184 
00185 #ifdef OSG_SGI_CC
00186 #pragma set woff 1174
00187 #endif
00188 
00189 #ifdef OSG_LINUX_ICC
00190 #pragma warning( disable : 177 )
00191 #endif
00192 
00193 namespace
00194 {
00195     static Char8 cvsid_cpp       [] = "@(#)$Id: $";
00196     static Char8 cvsid_hpp       [] = OSGVERTEXPROGRAMCHUNKBASE_HEADER_CVSID;
00197     static Char8 cvsid_inl       [] = OSGVERTEXPROGRAMCHUNKBASE_INLINE_CVSID;
00198 
00199     static Char8 cvsid_fields_hpp[] = OSGVERTEXPROGRAMCHUNKFIELDS_HEADER_CVSID;
00200 }
00201 
00202 #ifdef __sgi
00203 #pragma reset woff 1174
00204 #endif
00205 

Generated on Thu Aug 25 04:11:57 2005 for OpenSG by  doxygen 1.4.3