diff --git a/include/osg/Point b/include/osg/Point index 557f891b1..44d6f79cf 100644 --- a/include/osg/Point +++ b/include/osg/Point @@ -93,7 +93,10 @@ class OSG_EXPORT Point : public StateAttribute void setPointParametersSupported(bool flag) { _isPointParametersSupported=flag; } bool isPointParametersSupported() const { return _isPointParametersSupported; } - + + void setPointSpriteCoordOriginSupported(bool flag) { _isPointSpriteCoordOriginSupported=flag; } + bool isPointSpriteCoordOriginSupported() const { return _isPointSpriteCoordOriginSupported; } + void glPointParameteri(GLenum pname, GLint param) const; void glPointParameterf(GLenum pname, GLfloat param) const; void glPointParameterfv(GLenum pname, const GLfloat *params) const; @@ -102,7 +105,8 @@ class OSG_EXPORT Point : public StateAttribute ~Extensions() {} - bool _isPointParametersSupported; + bool _isPointParametersSupported; + bool _isPointSpriteCoordOriginSupported; void* _glPointParameteri; void* _glPointParameterf; diff --git a/src/osg/Point.cpp b/src/osg/Point.cpp index 7b3471c91..0404c7962 100644 --- a/src/osg/Point.cpp +++ b/src/osg/Point.cpp @@ -111,11 +111,16 @@ Point::Extensions::Extensions(const Extensions& rhs): Referenced() { _isPointParametersSupported = rhs._isPointParametersSupported; + _isPointSpriteCoordOriginSupported = rhs._isPointSpriteCoordOriginSupported; + _glPointParameteri = rhs._glPointParameteri; + _glPointParameterf = rhs._glPointParameterf; + _glPointParameterfv = rhs._glPointParameterfv; } void Point::Extensions::lowestCommonDenominator(const Extensions& rhs) { if (!rhs._isPointParametersSupported) _isPointParametersSupported = false; + if (!rhs._isPointSpriteCoordOriginSupported) _isPointSpriteCoordOriginSupported = false; if (!rhs._glPointParameteri) _glPointParameteri = 0; if (!rhs._glPointParameterf) _glPointParameterf = 0; if (!rhs._glPointParameterfv) _glPointParameterfv = 0; @@ -128,6 +133,8 @@ void Point::Extensions::setupGLExtensions(unsigned int contextID) isGLExtensionSupported(contextID,"GL_EXT_point_parameters") || isGLExtensionSupported(contextID,"GL_SGIS_point_parameters"); + _isPointSpriteCoordOriginSupported = strncmp((const char*)glGetString(GL_VERSION),"2.0",3)>=0; + _glPointParameteri = getGLExtensionFuncPtr("glPointParameteri", "glPointParameteriARB"); if (!_glPointParameteri) _glPointParameteri = getGLExtensionFuncPtr("glPointParameteriEXT", "glPointParameteriSGIS"); diff --git a/src/osg/PointSprite.cpp b/src/osg/PointSprite.cpp index 504543fe3..a06094be3 100644 --- a/src/osg/PointSprite.cpp +++ b/src/osg/PointSprite.cpp @@ -57,7 +57,7 @@ void PointSprite::apply(osg::State& state) const const Point::Extensions* extensions = Point::getExtensions(state.getContextID(),true); - if (extensions->isPointParametersSupported()) + if (extensions->isPointSpriteCoordOriginSupported()) extensions->glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN,_coordOriginMode); }