Moved osg::BlenFunc::Extensions into osg::GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14571 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
parent
d02c0bdc49
commit
d83e641fad
@ -157,19 +157,6 @@ class OSG_EXPORT BlendFunc : public StateAttribute
|
||||
|
||||
virtual void apply(State& state) const;
|
||||
|
||||
/** Encapsulates queries of extension availability, obtains extension function pointers. */
|
||||
struct OSG_EXPORT Extensions : public osg::Referenced
|
||||
{
|
||||
Extensions(unsigned int contextID);
|
||||
|
||||
bool isBlendFuncSeparateSupported;
|
||||
void (GL_APIENTRY * glBlendFuncSeparate) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) ;
|
||||
|
||||
void (GL_APIENTRY * glBlendFunci) (GLuint buf, GLenum src, GLenum dst);
|
||||
void (GL_APIENTRY * glBlendFuncSeparatei) (GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) ;
|
||||
};
|
||||
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~BlendFunc();
|
||||
|
@ -742,6 +742,15 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced
|
||||
|
||||
void (GL_APIENTRY * glMemoryBarrier)( GLbitfield barriers );
|
||||
|
||||
// BlendFunc extensions
|
||||
bool isBlendFuncSeparateSupported;
|
||||
void (GL_APIENTRY * glBlendFuncSeparate) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) ;
|
||||
|
||||
void (GL_APIENTRY * glBlendFunci) (GLuint buf, GLenum src, GLenum dst);
|
||||
void (GL_APIENTRY * glBlendFuncSeparatei) (GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) ;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -17,19 +17,6 @@
|
||||
|
||||
using namespace osg;
|
||||
|
||||
// Set up extensions
|
||||
BlendFunc::Extensions::Extensions(unsigned int contextID)
|
||||
{
|
||||
isBlendFuncSeparateSupported = OSG_GLES2_FEATURES || OSG_GL3_FEATURES ||
|
||||
osg::isGLExtensionSupported(contextID, "GL_EXT_blend_func_separate") ||
|
||||
strncmp((const char*)glGetString(GL_VERSION), "1.4", 3) >= 0;
|
||||
|
||||
setGLExtensionFuncPtr(glBlendFuncSeparate, "glBlendFuncSeparate", "glBlendFuncSeparateEXT");
|
||||
|
||||
setGLExtensionFuncPtr(glBlendFunci, "glBlendFunci", "glBlendFunciARB");
|
||||
setGLExtensionFuncPtr(glBlendFuncSeparatei, "glBlendFuncSeparatei", "glBlendFuncSeparateiARB");
|
||||
}
|
||||
|
||||
BlendFunc::BlendFunc():
|
||||
_source_factor(SRC_ALPHA),
|
||||
_destination_factor(ONE_MINUS_SRC_ALPHA),
|
||||
@ -63,7 +50,7 @@ void BlendFunc::apply(State& state) const
|
||||
if (_source_factor != _source_factor_alpha ||
|
||||
_destination_factor != _destination_factor_alpha)
|
||||
{
|
||||
const Extensions* extensions = state.get<Extensions>();
|
||||
const GL2Extensions* extensions = state.get<GL2Extensions>();
|
||||
if (!extensions->isBlendFuncSeparateSupported)
|
||||
{
|
||||
OSG_WARN<<"Warning: BlendFunc::apply(..) failed, BlendFuncSeparate is not support by OpenGL driver, falling back to BlendFunc."<<std::endl;
|
||||
|
@ -28,7 +28,7 @@ BlendFunci::~BlendFunci()
|
||||
|
||||
void BlendFunci::apply(State& state) const
|
||||
{
|
||||
const Extensions* extensions = state.get<Extensions>();
|
||||
const GL2Extensions* extensions = state.get<GL2Extensions>();
|
||||
if (_source_factor != _source_factor_alpha ||
|
||||
_destination_factor != _destination_factor_alpha)
|
||||
{
|
||||
|
@ -274,6 +274,7 @@ GL2Extensions::GL2Extensions(unsigned int contextID)
|
||||
|
||||
setGLExtensionFuncPtr(glMemoryBarrier, "glMemoryBarrier", "glMemoryBarrierEXT" );
|
||||
|
||||
// BufferObject extensions
|
||||
setGLExtensionFuncPtr(glGenBuffers, "glGenBuffers","glGenBuffersARB");
|
||||
setGLExtensionFuncPtr(glBindBuffer, "glBindBuffer","glBindBufferARB");
|
||||
setGLExtensionFuncPtr(glBufferData, "glBufferData","glBufferDataARB");
|
||||
@ -295,6 +296,16 @@ GL2Extensions::GL2Extensions(unsigned int contextID)
|
||||
isTBOSupported = osg::isGLExtensionSupported(contextID,"GL_ARB_texture_buffer_object");
|
||||
|
||||
|
||||
// BlendFunc extensions
|
||||
isBlendFuncSeparateSupported = OSG_GLES2_FEATURES || OSG_GL3_FEATURES ||
|
||||
osg::isGLExtensionSupported(contextID, "GL_EXT_blend_func_separate") ||
|
||||
strncmp((const char*)glGetString(GL_VERSION), "1.4", 3) >= 0;
|
||||
|
||||
setGLExtensionFuncPtr(glBlendFuncSeparate, "glBlendFuncSeparate", "glBlendFuncSeparateEXT");
|
||||
|
||||
setGLExtensionFuncPtr(glBlendFunci, "glBlendFunci", "glBlendFunciARB");
|
||||
setGLExtensionFuncPtr(glBlendFuncSeparatei, "glBlendFuncSeparatei", "glBlendFuncSeparateiARB");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user