Moved local Extensions structs into GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14584 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
@@ -42,11 +42,8 @@ void ClampColor::apply(State& state) const
|
||||
|
||||
// get the contextID (user defined ID of 0 upwards) for the
|
||||
// current OpenGL context.
|
||||
const unsigned int contextID = state.getContextID();
|
||||
|
||||
const Extensions* extensions = getExtensions(contextID,true);
|
||||
|
||||
if (!extensions->isClampColorSupported())
|
||||
const GL2Extensions* extensions = state.get<GL2Extensions>();
|
||||
if (!extensions->isClampColorSupported)
|
||||
{
|
||||
OSG_WARN<<"Warning: ClampColor::apply(..) failed, ClampColor is not support by OpenGL driver."<<std::endl;
|
||||
return;
|
||||
@@ -56,60 +53,3 @@ void ClampColor::apply(State& state) const
|
||||
extensions->glClampColor(GL_CLAMP_FRAGMENT_COLOR, _clampFragmentColor);
|
||||
extensions->glClampColor(GL_CLAMP_READ_COLOR, _clampReadColor);
|
||||
}
|
||||
|
||||
|
||||
typedef buffered_value< ref_ptr<ClampColor::Extensions> > BufferedExtensions;
|
||||
static BufferedExtensions s_extensions;
|
||||
|
||||
ClampColor::Extensions* ClampColor::getExtensions(unsigned int contextID,bool createIfNotInitalized)
|
||||
{
|
||||
if (!s_extensions[contextID] && createIfNotInitalized) s_extensions[contextID] = new Extensions(contextID);
|
||||
return s_extensions[contextID].get();
|
||||
}
|
||||
|
||||
void ClampColor::setExtensions(unsigned int contextID,Extensions* extensions)
|
||||
{
|
||||
s_extensions[contextID] = extensions;
|
||||
}
|
||||
|
||||
|
||||
ClampColor::Extensions::Extensions(unsigned int contextID)
|
||||
{
|
||||
setupGLExtensions(contextID);
|
||||
}
|
||||
|
||||
ClampColor::Extensions::Extensions(const Extensions& rhs):
|
||||
Referenced()
|
||||
{
|
||||
_isClampColorSupported = rhs._isClampColorSupported;
|
||||
_glClampColor = rhs._glClampColor;
|
||||
}
|
||||
|
||||
void ClampColor::Extensions::lowestCommonDenominator(const Extensions& rhs)
|
||||
{
|
||||
if (!rhs._isClampColorSupported) _isClampColorSupported = false;
|
||||
if (!rhs._glClampColor) _glClampColor = 0;
|
||||
}
|
||||
|
||||
void ClampColor::Extensions::setupGLExtensions(unsigned int contextID)
|
||||
{
|
||||
_isClampColorSupported = OSG_GL3_FEATURES ||
|
||||
isGLExtensionSupported(contextID,"GL_ARB_color_buffer_float") ||
|
||||
strncmp((const char*)glGetString(GL_VERSION),"2.0",3)>=0;
|
||||
|
||||
setGLExtensionFuncPtr(_glClampColor, "glClampColor", "glClampColorARB");
|
||||
}
|
||||
|
||||
void ClampColor::Extensions::glClampColor(GLenum target, GLenum mode) const
|
||||
{
|
||||
if (_glClampColor)
|
||||
{
|
||||
_glClampColor(target,mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_WARN<<"Error: glClampColor not supported by OpenGL driver"<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user