From c4e2e85aa18b0f2f278b2b701ff69fd67947701d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 5 May 2005 09:18:03 +0000 Subject: [PATCH] From Farshid Lashkari, added Texture::Extension support for non power of two extension. --- include/osg/Texture | 4 +++- src/osg/Texture.cpp | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/osg/Texture b/include/osg/Texture index f7274bb69..60c60f709 100644 --- a/include/osg/Texture +++ b/include/osg/Texture @@ -470,7 +470,8 @@ class OSG_EXPORT Texture : public osg::StateAttribute void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *data) const; bool isClientStorageSupported() const { return _isClientStorageSupported; } - + + bool isNonPowerOfTwoTextureSupported() const { return _isNonPowerOfTwoTextureSupported; } protected: @@ -487,6 +488,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute bool _isShadowSupported; bool _isShadowAmbientSupported; bool _isClientStorageSupported; + bool _isNonPowerOfTwoTextureSupported; GLint _maxTextureSize; GLint _numTextureUnits; diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 2d4890096..8bfc0900b 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -1272,6 +1272,8 @@ Texture::Extensions::Extensions(const Extensions& rhs): _isShadowAmbientSupported = rhs._isShadowAmbientSupported; _isClientStorageSupported = rhs._isClientStorageSupported; + + _isNonPowerOfTwoTextureSupported = rhs._isNonPowerOfTwoTextureSupported; } void Texture::Extensions::lowestCommonDenominator(const Extensions& rhs) @@ -1299,6 +1301,8 @@ void Texture::Extensions::lowestCommonDenominator(const Extensions& rhs) if (!rhs._isShadowAmbientSupported) _isShadowAmbientSupported = false; if (!rhs._isClientStorageSupported) _isClientStorageSupported = false; + + if (!rhs._isNonPowerOfTwoTextureSupported) _isNonPowerOfTwoTextureSupported = false; } void Texture::Extensions::setupGLExtensions(unsigned int contextID) @@ -1327,6 +1331,9 @@ void Texture::Extensions::setupGLExtensions(unsigned int contextID) _isClientStorageSupported = isGLExtensionSupported(contextID,"GL_APPLE_client_storage"); + _isNonPowerOfTwoTextureSupported = ( glVersion >= 2.0 ) || + isGLExtensionSupported(contextID,"GL_ARB_texture_non_power_of_two"); + glGetIntegerv(GL_MAX_TEXTURE_SIZE,&_maxTextureSize); char *ptr;