From Colin Cochran, OES support for point sprites

This commit is contained in:
Robert Osfield
2013-09-09 14:58:25 +00:00
parent e9697859bd
commit 27b57dbf0c

View File

@@ -44,17 +44,31 @@ bool PointSprite::checkValidityOfAssociatedModes(osg::State& state) const
{
bool modeValid = isPointSpriteSupported(state.getContextID());
state.setModeValidity(GL_POINT_SPRITE_ARB, modeValid);
#if defined( OSG_GLES1_AVAILABLE ) || defined( OSG_GLES2_AVAILABLE )
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
{
#if defined( OSG_GL3_AVAILABLE )
const Point::Extensions* extensions = Point::getExtensions(state.getContextID(),true);
extensions->glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN,_coordOriginMode);
#elif defined( OSG_GLES1_AVAILABLE ) || defined( OSG_GLES2_AVAILABLE )
if(!isPointSpriteSupported(state.getContextID())) return;
glTexEnvi(GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, 1);
#elif defined( OSG_GL_FIXED_FUNCTION_AVAILABLE )
if(!isPointSpriteSupported(state.getContextID())) return;
glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, 1);
@@ -63,8 +77,10 @@ void PointSprite::apply(osg::State& state) const
if (extensions->isPointSpriteCoordOriginSupported())
extensions->glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN,_coordOriginMode);
#else
OSG_NOTICE<<"Warning: PointSprite::apply(State&) - not supported."<<std::endl;
#endif
}
@@ -86,7 +102,7 @@ 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_NV_point_sprite");
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;