From Bob Kuehne, added getting of the max number of texture units in

the Texture::Extension object
This commit is contained in:
Robert Osfield 2004-05-07 11:28:55 +00:00
parent 2c352ceb7c
commit 48dad727b1
2 changed files with 11 additions and 1 deletions

View File

@ -113,6 +113,10 @@
#define TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF
#endif
#if !defined( GL_MAX_TEXTURE_UNITS )
#define GL_MAX_TEXTURE_UNITS 0x84E2
#endif
namespace osg {
/** Texture base class which encapsulates OpenGl texture functionality which common betweent the various types of OpenGL textures.*/
@ -360,6 +364,9 @@ class SG_EXPORT Texture : public osg::StateAttribute
void setMaxTextureSize(GLint maxsize) { _maxTextureSize=maxsize; }
GLint maxTextureSize() const { return _maxTextureSize; }
void setNumTextureUnits(GLint nunits ) { _numTextureUnits=nunits; }
GLint numTextureUnits() const { return _numTextureUnits; }
bool isCompressedTexImage2DSupported() const { return _glCompressedTexImage2D!=0; }
void setCompressedTexImage2DProc(void* ptr) { _glCompressedTexImage2D = ptr; }
@ -391,6 +398,7 @@ class SG_EXPORT Texture : public osg::StateAttribute
bool _isClientStorageSupported;
GLint _maxTextureSize;
GLint _numTextureUnits;
void* _glCompressedTexImage2D;
void* _glCompressedTexSubImage2D;

View File

@ -1102,6 +1102,7 @@ void Texture::Extensions::lowestCommonDenominator(const Extensions& rhs)
if (!rhs._isGenerateMipMapSupported) _isGenerateMipMapSupported = false;
if (rhs._maxTextureSize<_maxTextureSize) _maxTextureSize = rhs._maxTextureSize;
if (rhs._numTextureUnits<_numTextureUnits) _numTextureUnits = rhs._numTextureUnits;
if (!rhs._glCompressedTexImage2D) _glCompressedTexImage2D = 0;
if (!rhs._glCompressedTexSubImage2D) _glCompressedTexSubImage2D = 0;
@ -1147,9 +1148,10 @@ void Texture::Extensions::setupGLExtensions()
_maxTextureSize = osg_max_size;
}
}
glGetIntegerv(GL_MAX_TEXTURE_UNITS,&_numTextureUnits);
_glCompressedTexImage2D = getGLExtensionFuncPtr("glCompressedTexImage2D","glCompressedTexImage2DARB");
_glCompressedTexSubImage2D = getGLExtensionFuncPtr("glCompressedTexSubImage2D","glCompressedTexSubImage2DARB");
_glGetCompressedTexImage = getGLExtensionFuncPtr("glGetCompressedTexImage","glGetCompressedTexImageARB");;