root/OpenSceneGraph/trunk/src/osg/TexEnv.cpp @ 13041

Revision 13041, 1.6 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13#include <osg/GLExtensions>
14#include <osg/TexEnv>
15#include <osg/State>
16#include <osg/Notify>
17
18using namespace osg;
19
20TexEnv::TexEnv(Mode mode)
21{
22    _mode = mode;
23    _color.set(0.0f,0.0f,0.0f,0.0f);
24}
25
26
27TexEnv::~TexEnv()
28{
29}
30
31void TexEnv::apply(State& state) const
32{
33#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
34    if (_mode==ADD)
35    {
36        static bool isTexEnvAddSupported = isGLExtensionSupported(state.getContextID(),"GL_ARB_texture_env_add");
37        if (isTexEnvAddSupported)
38            glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, ADD);
39        else // fallback on OpenGL default.
40            glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, MODULATE);
41    }
42    else
43    {
44        glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, _mode);
45        if (_mode==TexEnv::BLEND)
46        {
47            glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, _color.ptr());
48        }
49    }
50#else
51    OSG_NOTICE<<"Warning: TexEnv::apply(State&) - not supported."<<std::endl;
52#endif
53}
Note: See TracBrowser for help on using the browser.