1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
46 #include <boost/bind.hpp>
48 #include "OSGConfig.h"
55 #include "OSGDrawEnv.h"
57 #include "OSGTextureBaseChunk.h"
59 //#define OSG_DUMP_TEX
63 // Documentation for this class is emited in the
64 // OSGTextureBaseChunkBase.cpp file.
65 // To modify it, please change the .fcd file (OSGTextureBaseChunk.fcd) and
66 // regenerate the base file.
68 /***************************************************************************\
70 \***************************************************************************/
72 StateChunkClass
TextureBaseChunk::_class("Texture", osgMaxTexImages
, 20);
74 volatile UInt16
TextureBaseChunk::_uiChunkCounter
= 1;
76 UInt32
TextureBaseChunk::_arbMultiTex
= Window::invalidExtensionID
;
77 UInt32
TextureBaseChunk::_funcActiveTexture
= Window::invalidFunctionID
;
79 /***************************************************************************\
81 \***************************************************************************/
83 /*-------------------------------------------------------------------------*\
85 \*-------------------------------------------------------------------------*/
87 void TextureBaseChunk::initMethod(InitPhase ePhase
)
89 Inherited::initMethod(ePhase
);
91 if(ePhase
== TypeObject::SystemPost
)
94 Window::registerExtension("GL_ARB_multitexture");
97 Window::registerFunction (OSG_DLSYM_UNDERSCORE
"glActiveTextureARB",
103 /***************************************************************************\
105 \***************************************************************************/
107 /*-------------------------------------------------------------------------*\
109 \*-------------------------------------------------------------------------*/
112 /*------------- constructors & destructors --------------------------------*/
114 TextureBaseChunk::TextureBaseChunk(void) :
120 TextureBaseChunk::TextureBaseChunk(const TextureBaseChunk
&source
) :
126 TextureBaseChunk::~TextureBaseChunk(void)
130 /*------------------------- Chunk Class Access ---------------------------*/
132 const StateChunkClass
*TextureBaseChunk::getClass(void) const
137 /*------------------------------- Sync -----------------------------------*/
139 /*! React to field changes.
140 Note: this function also handles CubeTexture changes, make sure to keep
141 it consistent with the cubeTexture specifics
144 void TextureBaseChunk::changed(ConstFieldMaskArg whichField
,
148 Inherited::changed(whichField
, origin
, details
);
152 /*----------------------------- onCreate --------------------------------*/
154 void TextureBaseChunk::onCreate(const TextureBaseChunk
*source
)
156 Inherited::onCreate(source
);
158 if(GlobalSystemState
== Startup
)
161 _uiChunkId
= _uiChunkCounter
++;
164 void TextureBaseChunk::onCreateAspect(const TextureBaseChunk
*createAspect
,
165 const TextureBaseChunk
*source
)
167 Inherited::onCreateAspect(createAspect
, source
);
169 _uiChunkId
= createAspect
->_uiChunkId
;
172 /*------------------------------ Output ----------------------------------*/
174 void TextureBaseChunk::dump( UInt32 uiIndent
,
175 const BitVector bvFlags
) const
177 Inherited::dump(uiIndent
, bvFlags
);
179 if((bvFlags
& TargetFieldMask
) != 0)
181 indentLog(uiIndent
, PLOG
);
183 << GLDefineMapper::the()->toString(_sfTarget
.getValue())
188 bool TextureBaseChunk::isCubeTexture(void)
193 /*------------------------------ State ------------------------------------*/
196 /*-------------------------- Comparison -----------------------------------*/