From 27b57dbf0cacf65c394165e2b8f8e1bbb258a741 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 9 Sep 2013 14:58:25 +0000 Subject: [PATCH] From Colin Cochran, OES support for point sprites --- src/osg/PointSprite.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/osg/PointSprite.cpp b/src/osg/PointSprite.cpp index 2d53f61e9..0bf9330bf 100644 --- a/src/osg/PointSprite.cpp +++ b/src/osg/PointSprite.cpp @@ -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."<