changed: gcc8 base update
[opensg.git] / Source / System / State / Base / OSGTextureBaseChunk.inl
blob9f7a2ada1e0d570cfe512ed15488ade4fd0c8bbb
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *                     Copyright 2000-2002 by OpenSG Forum                   *
6  *                                                                           *
7  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
8  *                                                                           *
9 \*---------------------------------------------------------------------------*/
10 /*---------------------------------------------------------------------------*\
11  *                                License                                    *
12  *                                                                           *
13  * This library is free software; you can redistribute it and/or modify it   *
14  * under the terms of the GNU Library General Public License as published    *
15  * by the Free Software Foundation, version 2.                               *
16  *                                                                           *
17  * This library is distributed in the hope that it will be useful, but       *
18  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
20  * Library General Public License for more details.                          *
21  *                                                                           *
22  * You should have received a copy of the GNU Library General Public         *
23  * License along with this library; if not, write to the Free Software       *
24  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
25  *                                                                           *
26 \*---------------------------------------------------------------------------*/
27 /*---------------------------------------------------------------------------*\
28  *                                Changes                                    *
29  *                                                                           *
30  *                                                                           *
31  *                                                                           *
32  *                                                                           *
33  *                                                                           *
34  *                                                                           *
35 \*---------------------------------------------------------------------------*/
38 OSG_BEGIN_NAMESPACE
40 inline
41 const StateChunkClass *TextureBaseChunk::getStaticClass(void)
43     return &TextureBaseChunk::_class;
46 inline
47 UInt32 TextureBaseChunk::getStaticClassId(void)
49     return getStaticClass()->getId();
52 inline
53 UInt16 TextureBaseChunk::getChunkId(void)
55     return _uiChunkId;
58 inline 
59 bool TextureBaseChunk::hasMultiTexture(Window *win)
61     return win->hasExtOrVersion(_arbMultiTex, 0x0103, 0x0200);
64 //! call glActiveTexture via the extension mechanism
65 inline 
66 void TextureBaseChunk::activeTexture(Window *win, UInt16 texture)
68     OSGGETGLFUNCBYID_GL3_ES( glActiveTexture,
69                              osgGlActiveTexture,
70                             _funcActiveTexture,
71                              win);
73     osgGlActiveTexture(GL_TEXTURE0 + texture);
76 //! call glActiveTexture via the extension mechanism, if MultiTextures
77 //! are supported. Return false if successful, true if not.
78 inline 
79 bool TextureBaseChunk::activateTexture(Window *win, UInt16 texture)
81     if(hasMultiTexture(win))
82     {
83         activeTexture(win, texture);
84     }
85 #ifdef OSG_DEBUG
86     else
87     {
88         if(texture != 0)
89         {
90             FWARNING(("TextureChunk::activateTexture: trying to activate "
91                       "texture %d, but Window %p doesn't support "
92                       "multi-textures!\n", 
93                       texture, 
94                       static_cast<void *>(win)));
95             return true;
96         }
97     }
98 #endif
99     return false;
103 OSG_END_NAMESPACE