Added Point::Extension::isPointSpriteCoordOriginSupported() method
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user