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,68 +42,42 @@ int PointSprite::compare(const StateAttribute& sa) const
|
||||
|
||||
bool PointSprite::checkValidityOfAssociatedModes(osg::State& state) const
|
||||
{
|
||||
|
||||
bool modeValid = isPointSpriteSupported(state.getContextID());
|
||||
const GL2Extensions* extensions = state.get<GL2Extensions>();
|
||||
bool modeValid = extensions->isPointSpriteSupported;
|
||||
|
||||
#if defined( OSG_GLES1_AVAILABLE ) //point sprites don't exist on es 2.0
|
||||
state.setModeValidity(GL_POINT_SPRITE_OES, modeValid);
|
||||
#else
|
||||
state.setModeValidity(GL_POINT_SPRITE_ARB, modeValid);
|
||||
#endif
|
||||
|
||||
|
||||
return modeValid;
|
||||
}
|
||||
|
||||
void PointSprite::apply(osg::State& state) const
|
||||
{
|
||||
const GL2Extensions* extensions = state.get<GL2Extensions>();
|
||||
#if defined( OSG_GL3_AVAILABLE )
|
||||
|
||||
const Point::Extensions* extensions = Point::getExtensions(state.getContextID(),true);
|
||||
extensions->glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN,_coordOriginMode);
|
||||
|
||||
extensions->glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, _coordOriginMode);
|
||||
|
||||
#elif defined( OSG_GLES1_AVAILABLE ) //point sprites don't exist on es 2.0
|
||||
|
||||
if(!isPointSpriteSupported(state.getContextID())) return;
|
||||
|
||||
|
||||
if (!extensions->isPointSpriteSupported) return;
|
||||
|
||||
glTexEnvi(GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, 1);
|
||||
|
||||
|
||||
#elif defined( OSG_GL_FIXED_FUNCTION_AVAILABLE )
|
||||
|
||||
if(!isPointSpriteSupported(state.getContextID())) return;
|
||||
if (!extensions->isPointSpriteSupported) return;
|
||||
|
||||
glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, 1);
|
||||
|
||||
const Point::Extensions* extensions = Point::getExtensions(state.getContextID(),true);
|
||||
|
||||
if (extensions->isPointSpriteCoordOriginSupported())
|
||||
extensions->glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN,_coordOriginMode);
|
||||
if (extensions->isPointSpriteCoordOriginSupported)
|
||||
extensions->glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, _coordOriginMode);
|
||||
|
||||
#else
|
||||
OSG_NOTICE<<"Warning: PointSprite::apply(State&) - not supported."<<std::endl;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
struct IntializedSupportedPair
|
||||
{
|
||||
IntializedSupportedPair():
|
||||
initialized(false),
|
||||
supported(false) {}
|
||||
|
||||
bool initialized;
|
||||
bool supported;
|
||||
};
|
||||
|
||||
typedef osg::buffered_object< IntializedSupportedPair > BufferedExtensions;
|
||||
static BufferedExtensions s_extensions;
|
||||
|
||||
bool PointSprite::isPointSpriteSupported(unsigned int contextID)
|
||||
{
|
||||
if (!s_extensions[contextID].initialized)
|
||||
{
|
||||
s_extensions[contextID].initialized = true;
|
||||
s_extensions[contextID].supported = OSG_GL3_FEATURES || isGLExtensionSupported(contextID, "GL_ARB_point_sprite") || isGLExtensionSupported(contextID, "GL_OES_point_sprite") || isGLExtensionSupported(contextID, "GL_NV_point_sprite");
|
||||
}
|
||||
|
||||
return s_extensions[contextID].supported;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user