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 <cstdlib> 00044 #include <cstdio> 00045 00046 #include <boost/bind.hpp> 00047 00048 #include "OSGConfig.h" 00049 00050 #include <OSGGL.h> 00051 #include <OSGGLU.h> 00052 #include <OSGGLEXT.h> 00053 #include <OSGImage.h> 00054 00055 #include "OSGDrawActionBase.h" 00056 #include "OSGDrawEnv.h" 00057 00058 #include "OSGTextureBaseChunk.h" 00059 00060 //#define OSG_DUMP_TEX 00061 00062 OSG_USING_NAMESPACE 00063 00064 // Documentation for this class is emited in the 00065 // OSGTextureBaseChunkBase.cpp file. 00066 // To modify it, please change the .fcd file (OSGTextureBaseChunk.fcd) and 00067 // regenerate the base file. 00068 00069 /***************************************************************************\ 00070 * Class variables * 00071 \***************************************************************************/ 00072 00073 StateChunkClass TextureBaseChunk::_class("Texture", osgMaxTexImages, 15); 00074 00075 volatile UInt16 TextureBaseChunk::_uiChunkCounter = 1; 00076 00077 UInt32 TextureBaseChunk::_arbMultiTex = Window::invalidExtensionID; 00078 UInt32 TextureBaseChunk::_funcActiveTexture = Window::invalidFunctionID; 00079 00080 /***************************************************************************\ 00081 * Class methods * 00082 \***************************************************************************/ 00083 00084 /*-------------------------------------------------------------------------*\ 00085 - private - 00086 \*-------------------------------------------------------------------------*/ 00087 00088 void TextureBaseChunk::initMethod(InitPhase ePhase) 00089 { 00090 Inherited::initMethod(ePhase); 00091 00092 if(ePhase == TypeObject::SystemPost) 00093 { 00094 _arbMultiTex = 00095 Window::registerExtension("GL_ARB_multitexture"); 00096 00097 _funcActiveTexture = 00098 Window::registerFunction (OSG_DLSYM_UNDERSCORE"glActiveTextureARB", 00099 _arbMultiTex); 00100 } 00101 00102 } 00103 00104 /***************************************************************************\ 00105 * Instance methods * 00106 \***************************************************************************/ 00107 00108 /*-------------------------------------------------------------------------*\ 00109 - private - 00110 \*-------------------------------------------------------------------------*/ 00111 00112 00113 /*------------- constructors & destructors --------------------------------*/ 00114 00115 TextureBaseChunk::TextureBaseChunk(void) : 00116 Inherited( ), 00117 _uiChunkId(0) 00118 { 00119 } 00120 00121 TextureBaseChunk::TextureBaseChunk(const TextureBaseChunk &source) : 00122 Inherited(source), 00123 _uiChunkId( 0) 00124 { 00125 } 00126 00127 TextureBaseChunk::~TextureBaseChunk(void) 00128 { 00129 } 00130 00131 /*------------------------- Chunk Class Access ---------------------------*/ 00132 00133 const StateChunkClass *TextureBaseChunk::getClass(void) const 00134 { 00135 return &_class; 00136 } 00137 00138 /*------------------------------- Sync -----------------------------------*/ 00139 00145 void TextureBaseChunk::changed(ConstFieldMaskArg whichField, 00146 UInt32 origin, 00147 BitVector details) 00148 { 00149 Inherited::changed(whichField, origin, details); 00150 } 00151 00152 00153 /*----------------------------- onCreate --------------------------------*/ 00154 00155 void TextureBaseChunk::onCreate(const TextureBaseChunk *source) 00156 { 00157 Inherited::onCreate(source); 00158 00159 if(GlobalSystemState == Startup) 00160 return; 00161 00162 _uiChunkId = _uiChunkCounter++; 00163 } 00164 00165 void TextureBaseChunk::onCreateAspect(const TextureBaseChunk *createAspect, 00166 const TextureBaseChunk *source ) 00167 { 00168 Inherited::onCreateAspect(createAspect, source); 00169 00170 _uiChunkId = createAspect->_uiChunkId; 00171 } 00172 00173 /*------------------------------ Output ----------------------------------*/ 00174 00175 void TextureBaseChunk::dump( UInt32 OSG_CHECK_ARG(uiIndent), 00176 const BitVector OSG_CHECK_ARG(bvFlags )) const 00177 { 00178 SLOG << "Dump TextureBaseChunk NI" << std::endl; 00179 } 00180 00181 bool TextureBaseChunk::isCubeTexture(void) 00182 { 00183 return false; 00184 } 00185 00186 /*------------------------------ State ------------------------------------*/ 00187 00188 00189 /*-------------------------- Comparison -----------------------------------*/ 00190