Added osg::Capability and Cabibilityi base classes to wrap up glEnable/glDisable + glEnablei/glDisablei functionality, with osg::Enablei and osg::Disablei concrete implementations.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14564 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
@@ -43,6 +43,7 @@ SET(TARGET_H
|
||||
${HEADER_PATH}/Callback
|
||||
${HEADER_PATH}/Camera
|
||||
${HEADER_PATH}/CameraView
|
||||
${HEADER_PATH}/Capability
|
||||
${HEADER_PATH}/ClampColor
|
||||
${HEADER_PATH}/ClearNode
|
||||
${HEADER_PATH}/ClipNode
|
||||
@@ -239,6 +240,7 @@ SET(TARGET_SRC
|
||||
BufferIndexBinding.cpp
|
||||
BufferObject.cpp
|
||||
Callback.cpp
|
||||
Capability.cpp
|
||||
Camera.cpp
|
||||
CameraView.cpp
|
||||
ClampColor.cpp
|
||||
|
||||
72
src/osg/Capability.cpp
Normal file
72
src/osg/Capability.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include <osg/Capability>
|
||||
#include <osg/GLExtensions>
|
||||
#include <osg/State>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
|
||||
Capability::Capability():
|
||||
_capability(0)
|
||||
{
|
||||
}
|
||||
|
||||
Capability::~Capability()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Capabilityi::Extensions::Extensions(unsigned int contextID)
|
||||
{
|
||||
setGLExtensionFuncPtr(glEnablei, "glEnablei");
|
||||
setGLExtensionFuncPtr(glDisablei, "glDisablei");
|
||||
}
|
||||
|
||||
Capabilityi::Capabilityi():
|
||||
_index(0)
|
||||
{
|
||||
}
|
||||
|
||||
Capabilityi::~Capabilityi()
|
||||
{
|
||||
}
|
||||
|
||||
void Enablei::apply(State& state) const
|
||||
{
|
||||
const Extensions* extensions = state.get<Extensions>();
|
||||
if (extensions->glEnablei)
|
||||
{
|
||||
OSG_NOTICE<<"extensions->glEnablei("<<_capability<<", "<<_index<<")"<<std::endl;
|
||||
extensions->glEnablei(_capability, static_cast<GLuint>(_index));
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_WARN<<"Warning: Enablei::apply(..) failed, Enablei is not support by OpenGL driver."<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void Disablei::apply(State& state) const
|
||||
{
|
||||
const Extensions* extensions = state.get<Extensions>();
|
||||
if (extensions->glDisablei)
|
||||
{
|
||||
OSG_NOTICE<<"extensions->glDisablei("<<_capability<<", "<<_index<<")"<<std::endl;
|
||||
extensions->glDisablei(_capability, static_cast<GLuint>(_index));
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_WARN<<"Warning: Enablei::apply(..) failed, Enablei is not support by OpenGL driver."<<std::endl;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user