Moved Texture*::Extensions functionality into GL2Extensions

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14581 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-12-09 10:05:59 +00:00
parent a8804e2366
commit cceee38727
15 changed files with 293 additions and 590 deletions

View File

@@ -398,6 +398,7 @@ GL2Extensions::GL2Extensions(unsigned int contextID)
isSampleMaskiSupported = glSampleMaski!=0;
// old styple Vertex/Fragment Programs
isVertexProgramSupported = isGLExtensionSupported(contextID,"GL_ARB_vertex_program");
isFragmentProgramSupported = isGLExtensionSupported(contextID,"GL_ARB_fragment_program");
@@ -410,6 +411,121 @@ GL2Extensions::GL2Extensions(unsigned int contextID)
// Texture extensions
const char* renderer = (const char*) glGetString(GL_RENDERER);
std::string rendererString(renderer ? renderer : "");
bool radeonHardwareDetected = (rendererString.find("Radeon")!=std::string::npos || rendererString.find("RADEON")!=std::string::npos);
bool fireGLHardwareDetected = (rendererString.find("FireGL")!=std::string::npos || rendererString.find("FIREGL")!=std::string::npos);
bool builtInSupport = OSG_GLES2_FEATURES || OSG_GL3_FEATURES;
isMultiTexturingSupported = builtInSupport || OSG_GLES1_FEATURES ||
isGLExtensionOrVersionSupported( contextID,"GL_ARB_multitexture", 1.3f) ||
isGLExtensionOrVersionSupported(contextID,"GL_EXT_multitexture", 1.3f);
isTextureFilterAnisotropicSupported = isGLExtensionSupported(contextID,"GL_EXT_texture_filter_anisotropic");
isTextureSwizzleSupported = isGLExtensionSupported(contextID,"GL_ARB_texture_swizzle");
isTextureCompressionARBSupported = builtInSupport || isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_compression", 1.3f);
isTextureCompressionS3TCSupported = isGLExtensionSupported(contextID,"GL_EXT_texture_compression_s3tc");
isTextureCompressionPVRTC2BPPSupported = isGLExtensionSupported(contextID,"GL_IMG_texture_compression_pvrtc");
isTextureCompressionPVRTC4BPPSupported = isTextureCompressionPVRTC2BPPSupported;//covered by same extension
isTextureCompressionETCSupported = isGLExtensionSupported(contextID,"GL_OES_compressed_ETC1_RGB8_texture");
isTextureCompressionETC2Supported = isGLExtensionSupported(contextID,"GL_ARB_ES3_compatibility");
isTextureCompressionRGTCSupported = isGLExtensionSupported(contextID,"GL_EXT_texture_compression_rgtc");
isTextureCompressionPVRTCSupported = isGLExtensionSupported(contextID,"GL_IMG_texture_compression_pvrtc");
isTextureMirroredRepeatSupported = builtInSupport ||
isGLExtensionOrVersionSupported(contextID,"GL_IBM_texture_mirrored_repeat", 1.4f) ||
isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_mirrored_repeat", 1.4f);
isTextureEdgeClampSupported = builtInSupport ||
isGLExtensionOrVersionSupported(contextID,"GL_EXT_texture_edge_clamp", 1.2f) ||
isGLExtensionOrVersionSupported(contextID,"GL_SGIS_texture_edge_clamp", 1.2f);
isTextureBorderClampSupported = OSG_GL3_FEATURES || ((OSG_GL1_FEATURES || OSG_GL2_FEATURES) && isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_border_clamp", 1.3f));
isGenerateMipMapSupported = builtInSupport || isGLExtensionOrVersionSupported(contextID,"GL_SGIS_generate_mipmap", 1.4f);
preferGenerateMipmapSGISForPowerOfTwo = (radeonHardwareDetected||fireGLHardwareDetected) ? false : true;
isTextureMultisampledSupported = isGLExtensionSupported(contextID,"GL_ARB_texture_multisample");
isShadowSupported = OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_ARB_shadow");
isShadowAmbientSupported = isGLExtensionSupported(contextID,"GL_ARB_shadow_ambient");
isClientStorageSupported = isGLExtensionSupported(contextID,"GL_APPLE_client_storage");
isNonPowerOfTwoTextureNonMipMappedSupported = builtInSupport || isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_non_power_of_two", 2.0) || isGLExtensionSupported(contextID,"GL_APPLE_texture_2D_limited_npot");
isNonPowerOfTwoTextureMipMappedSupported = builtInSupport || isNonPowerOfTwoTextureNonMipMappedSupported;
isTextureIntegerEXTSupported = OSG_GL3_FEATURES || isGLExtensionSupported(contextID, "GL_EXT_texture_integer");
if (rendererString.find("GeForce FX")!=std::string::npos)
{
isNonPowerOfTwoTextureMipMappedSupported = false;
OSG_INFO<<"Disabling _isNonPowerOfTwoTextureMipMappedSupported for GeForce FX hardware."<<std::endl;
}
maxTextureSize=0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE,&maxTextureSize);
char *ptr;
if( (ptr = getenv("OSG_MAX_TEXTURE_SIZE")) != 0)
{
GLint osg_max_size = atoi(ptr);
if (osg_max_size<maxTextureSize)
{
maxTextureSize = osg_max_size;
}
}
setGLExtensionFuncPtr(glTexStorage2D,"glTexStorage2D","glTexStorage2DARB");
setGLExtensionFuncPtr(glCompressedTexImage2D,"glCompressedTexImage2D","glCompressedTexImage2DARB");
setGLExtensionFuncPtr(glCompressedTexSubImage2D,"glCompressedTexSubImage2D","glCompressedTexSubImage2DARB");
setGLExtensionFuncPtr(glGetCompressedTexImage,"glGetCompressedTexImage","glGetCompressedTexImageARB");;
setGLExtensionFuncPtr(glTexImage2DMultisample, "glTexImage2DMultisample", "glTexImage2DMultisampleARB");
setGLExtensionFuncPtr(glTexParameterIiv, "glTexParameterIiv", "glTexParameterIivARB");
setGLExtensionFuncPtr(glTexParameterIuiv, "glTexParameterIuiv", "glTexParameterIuivARB");
if (glTexParameterIiv == NULL) setGLExtensionFuncPtr(glTexParameterIiv, "glTexParameterIivEXT");
if (glTexParameterIuiv == NULL) setGLExtensionFuncPtr(glTexParameterIuiv, "glTexParameterIuivEXT");
setGLExtensionFuncPtr(glBindImageTexture, "glBindImageTexture", "glBindImageTextureARB");
isTextureMaxLevelSupported = ( getGLVersionNumber() >= 1.2f );
isTextureStorageEnabled = isTexStorage2DSupported();
if ( (ptr = getenv("OSG_GL_TEXTURE_STORAGE")) != 0 && isTexStorage2DSupported())
{
if (strcmp(ptr,"OFF")==0 || strcmp(ptr,"DISABLE")==0 ) isTextureStorageEnabled = false;
else isTextureStorageEnabled = true;
}
// Texture3D extensions
isTexture3DFast = OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_EXT_texture3D");
if (isTexture3DFast) isTexture3DSupported = true;
else isTexture3DSupported = strncmp((const char*)glGetString(GL_VERSION),"1.2",3)>=0;
maxTexture3DSize = 0;
glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &maxTexture3DSize);
setGLExtensionFuncPtr(glTexImage3D, "glTexImage3D","glTexImage3DEXT");
setGLExtensionFuncPtr(glTexSubImage3D, "glTexSubImage3D","glTexSubImage3DEXT");
setGLExtensionFuncPtr(glCompressedTexImage3D, "glCompressedTexImage3D","glCompressedTexImage3DARB");
setGLExtensionFuncPtr(glCompressedTexSubImage3D, "glCompressedTexSubImage3D","glCompressedTexSubImage3DARB");
setGLExtensionFuncPtr(glCopyTexSubImage3D, "glCopyTexSubImage3D","glCopyTexSubImage3DEXT");
// Texture2DArray extensions
isTexture2DArraySupported = OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_EXT_texture_array");
max2DSize = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max2DSize);
maxLayerCount = 0;
glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS_EXT, &maxLayerCount);
}

View File

@@ -1053,10 +1053,7 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
// OSG_NOTICE<<"Image::readImageFromCurrentTexture()"<<std::endl;
const osg::Texture::Extensions* extensions = osg::Texture::getExtensions(contextID,true);
const osg::Texture3D::Extensions* extensions3D = osg::Texture3D::getExtensions(contextID,true);
const osg::Texture2DArray::Extensions* extensions2DArray = osg::Texture2DArray::getExtensions(contextID,true);
const osg::GL2Extensions* extensions = osg::GL2Extensions::Get(contextID,true);
GLboolean binding1D = GL_FALSE, binding2D = GL_FALSE, binding3D = GL_FALSE, binding2DArray = GL_FALSE, bindingCubeMap = GL_FALSE;
@@ -1065,7 +1062,7 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
glGetBooleanv(GL_TEXTURE_BINDING_3D, &binding3D);
glGetBooleanv(GL_TEXTURE_BINDING_CUBE_MAP, &bindingCubeMap);
if (extensions2DArray->isTexture2DArraySupported())
if (extensions->isTexture2DArraySupported)
{
glGetBooleanv(GL_TEXTURE_BINDING_2D_ARRAY_EXT, &binding2DArray);
}
@@ -1136,14 +1133,14 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
}
else if (textureMode==GL_TEXTURE_3D)
{
if (extensions3D->isCompressedTexImage3DSupported())
if (extensions->isCompressedTexImage3DSupported())
{
glGetTexLevelParameteriv(textureMode, 0, GL_TEXTURE_COMPRESSED_ARB,&compressed);
}
}
else if (textureMode==GL_TEXTURE_2D_ARRAY_EXT)
{
if (extensions2DArray->isCompressedTexImage3DSupported())
if (extensions->isCompressedTexImage3DSupported())
{
glGetTexLevelParameteriv(textureMode, 0, GL_TEXTURE_COMPRESSED_ARB,&compressed);
}

View File

@@ -62,9 +62,6 @@ namespace osg {
ApplicationUsageProxy Texture_e0(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_MAX_TEXTURE_SIZE","Set the maximum size of textures.");
ApplicationUsageProxy Texture_e1(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_GL_TEXTURE_STORAGE","ON|OFF or ENABLE|DISABLE, Enables/disables usage of glTexStorage for textures where supported, default is ENABLED.");
typedef buffered_value< ref_ptr<Texture::Extensions> > BufferedExtensions;
static BufferedExtensions s_extensions;
struct InternalPixelRelations
{
GLenum sizedInternalFormat;
@@ -1468,12 +1465,12 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
{
const unsigned int contextID = 0; // state.getContextID(); // set to 0 right now, assume same parameters for each graphics context...
const Extensions* extensions = getExtensions(contextID,true);
const GL2Extensions* extensions = GL2Extensions::Get(contextID,true);
switch(_internalFormatMode)
{
case(USE_ARB_COMPRESSION):
if (extensions->isTextureCompressionARBSupported())
if (extensions->isTextureCompressionARBSupported)
{
switch(image.getPixelFormat())
{
@@ -1492,7 +1489,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
break;
case(USE_S3TC_DXT1_COMPRESSION):
if (extensions->isTextureCompressionS3TCSupported())
if (extensions->isTextureCompressionS3TCSupported)
{
switch(image.getPixelFormat())
{
@@ -1506,7 +1503,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
break;
case(USE_S3TC_DXT1c_COMPRESSION):
if (extensions->isTextureCompressionS3TCSupported())
if (extensions->isTextureCompressionS3TCSupported)
{
switch(image.getPixelFormat())
{
@@ -1520,7 +1517,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
break;
case(USE_S3TC_DXT1a_COMPRESSION):
if (extensions->isTextureCompressionS3TCSupported())
if (extensions->isTextureCompressionS3TCSupported)
{
switch(image.getPixelFormat())
{
@@ -1534,7 +1531,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
break;
case(USE_S3TC_DXT3_COMPRESSION):
if (extensions->isTextureCompressionS3TCSupported())
if (extensions->isTextureCompressionS3TCSupported)
{
switch(image.getPixelFormat())
{
@@ -1548,7 +1545,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
break;
case(USE_S3TC_DXT5_COMPRESSION):
if (extensions->isTextureCompressionS3TCSupported())
if (extensions->isTextureCompressionS3TCSupported)
{
switch(image.getPixelFormat())
{
@@ -1562,7 +1559,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
break;
case(USE_PVRTC_2BPP_COMPRESSION):
if (extensions->isTextureCompressionPVRTC2BPPSupported())
if (extensions->isTextureCompressionPVRTC2BPPSupported)
{
switch(image.getPixelFormat())
{
@@ -1576,7 +1573,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
break;
case(USE_PVRTC_4BPP_COMPRESSION):
if (extensions->isTextureCompressionPVRTC4BPPSupported())
if (extensions->isTextureCompressionPVRTC4BPPSupported)
{
switch(image.getPixelFormat())
{
@@ -1590,7 +1587,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
break;
case(USE_ETC_COMPRESSION):
if (extensions->isTextureCompressionETCSupported())
if (extensions->isTextureCompressionETCSupported)
{
switch(image.getPixelFormat())
{
@@ -1602,7 +1599,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
break;
case(USE_ETC2_COMPRESSION):
if (extensions->isTextureCompressionETC2Supported())
if (extensions->isTextureCompressionETC2Supported)
{
switch(image.getPixelFormat())
{
@@ -1620,7 +1617,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
break;
case(USE_RGTC1_COMPRESSION):
if (extensions->isTextureCompressionRGTCSupported())
if (extensions->isTextureCompressionRGTCSupported)
{
switch(image.getPixelFormat())
{
@@ -1634,7 +1631,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
break;
case(USE_RGTC2_COMPRESSION):
if (extensions->isTextureCompressionRGTCSupported())
if (extensions->isTextureCompressionRGTCSupported)
{
switch(image.getPixelFormat())
{
@@ -1815,7 +1812,7 @@ void Texture::getCompressedSize(GLenum internalFormat, GLint width, GLint height
else if (internalFormat == GL_COMPRESSED_RGBA_S3TC_DXT3_EXT || internalFormat == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)
blockSize = 16;
else if (internalFormat == GL_ETC1_RGB8_OES)
blockSize = 8;
blockSize = 8;
else if (internalFormat == GL_COMPRESSED_RGB8_ETC2 || internalFormat == GL_COMPRESSED_SRGB8_ETC2)
blockSize = 8;
else if (internalFormat == GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 || internalFormat == GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2)
@@ -1876,12 +1873,12 @@ void Texture::applyTexParameters(GLenum target, State& state) const
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
WrapMode ws = _wrap_s, wt = _wrap_t, wr = _wrap_r;
// GL_IBM_texture_mirrored_repeat, fall-back REPEAT
if (!extensions->isTextureMirroredRepeatSupported())
if (!extensions->isTextureMirroredRepeatSupported)
{
if (ws == MIRROR)
ws = REPEAT;
@@ -1892,7 +1889,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const
}
// GL_EXT_texture_edge_clamp, fall-back CLAMP
if (!extensions->isTextureEdgeClampSupported())
if (!extensions->isTextureEdgeClampSupported)
{
if (ws == CLAMP_TO_EDGE)
ws = CLAMP;
@@ -1902,7 +1899,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const
wr = CLAMP;
}
if(!extensions->isTextureBorderClampSupported())
if(!extensions->isTextureBorderClampSupported)
{
if(ws == CLAMP_TO_BORDER)
ws = CLAMP;
@@ -1921,7 +1918,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const
const Image * image = getImage(0);
if( image &&
image->isMipmap() &&
extensions->isTextureMaxLevelSupported() &&
extensions->isTextureMaxLevelSupported &&
int( image->getNumMipmapLevels() ) <
Image::computeNumberOfMipmapLevels( image->s(), image->t(), image->r() ) )
glTexParameteri( target, GL_TEXTURE_MAX_LEVEL, image->getNumMipmapLevels() - 1 );
@@ -1938,7 +1935,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const
glTexParameteri( target, GL_TEXTURE_MAG_FILTER, _mag_filter);
// Art: I think anisotropic filtering is not supported by the integer textures
if (extensions->isTextureFilterAnisotropicSupported() &&
if (extensions->isTextureFilterAnisotropicSupported &&
_internalFormatType != SIGNED_INTEGER && _internalFormatType != UNSIGNED_INTEGER)
{
// note, GL_TEXTURE_MAX_ANISOTROPY_EXT will either be defined
@@ -1946,14 +1943,14 @@ void Texture::applyTexParameters(GLenum target, State& state) const
glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, _maxAnisotropy);
}
if (extensions->isTextureSwizzleSupported())
if (extensions->isTextureSwizzleSupported)
{
// note, GL_TEXTURE_SWIZZLE_RGBA will either be defined
// by gl.h (or via glext.h) or by include/osg/Texture.
glTexParameteriv(target, GL_TEXTURE_SWIZZLE_RGBA, _swizzle.ptr());
}
if (extensions->isTextureBorderClampSupported())
if (extensions->isTextureBorderClampSupported)
{
#ifndef GL_TEXTURE_BORDER_COLOR
@@ -1977,7 +1974,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const
// integer textures are not supported by the shadow
// GL_TEXTURE_1D_ARRAY_EXT could be included in the check below but its not yet implemented in OSG
if (extensions->isShadowSupported() &&
if (extensions->isShadowSupported &&
(target == GL_TEXTURE_2D || target == GL_TEXTURE_1D || target == GL_TEXTURE_RECTANGLE || target == GL_TEXTURE_CUBE_MAP || target == GL_TEXTURE_2D_ARRAY_EXT ) &&
_internalFormatType != SIGNED_INTEGER && _internalFormatType != UNSIGNED_INTEGER)
{
@@ -1989,7 +1986,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const
// if ambient value is 0 - it is default behaviour of GL_ARB_shadow
// no need for GL_ARB_shadow_ambient in this case
if (extensions->isShadowAmbientSupported() && _shadow_ambient > 0)
if (extensions->isShadowAmbientSupported && _shadow_ambient > 0)
{
glTexParameterf(target, TEXTURE_COMPARE_FAIL_VALUE_ARB, _shadow_ambient);
}
@@ -2019,8 +2016,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const
void Texture::computeRequiredTextureDimensions(State& state, const osg::Image& image,GLsizei& inwidth, GLsizei& inheight,GLsizei& numMipmapLevels) const
{
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
int width,height;
@@ -2036,8 +2032,8 @@ void Texture::computeRequiredTextureDimensions(State& state, const osg::Image& i
}
// cap the size to what the graphics hardware can handle.
if (width>extensions->maxTextureSize()) width = extensions->maxTextureSize();
if (height>extensions->maxTextureSize()) height = extensions->maxTextureSize();
if (width>extensions->maxTextureSize) width = extensions->maxTextureSize;
if (height>extensions->maxTextureSize) height = extensions->maxTextureSize;
inwidth = width;
inheight = height;
@@ -2081,10 +2077,8 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
OSG_NOTICE<<"glTexImage2D pixelFormat = "<<std::hex<<image->getPixelFormat()<<std::dec<<std::endl;
#endif
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
// get extensions object
const GL2Extensions* extensions = state.get<GL2Extensions>();
// select the internalFormat required for the texture.
bool compressed_image = isCompressedInternalFormat((GLenum)image->getPixelFormat());
@@ -2136,7 +2130,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
glPixelStorei(GL_UNPACK_ALIGNMENT,image->getPacking());
unsigned int rowLength = image->getRowLength();
bool useClientStorage = extensions->isClientStorageSupported() && getClientStorageHint();
bool useClientStorage = extensions->isClientStorageSupported && getClientStorageHint();
if (useClientStorage)
{
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE,GL_TRUE);
@@ -2200,7 +2194,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
bool useHardwareMipMapGeneration = mipmappingRequired && (!image->isMipmap() && isHardwareMipmapGenerationEnabled(state));
bool useGluBuildMipMaps = mipmappingRequired && (!useHardwareMipMapGeneration && !image->isMipmap());
GLBufferObject* pbo = image->getOrCreateGLBufferObject(contextID);
GLBufferObject* pbo = image->getOrCreateGLBufferObject(state.getContextID());
if (pbo && !needImageRescale && !useGluBuildMipMaps)
{
state.bindPixelBufferObject(pbo);
@@ -2261,7 +2255,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
int width = inwidth;
int height = inheight;
bool useTexStorrage = extensions->isTexStorageEnabled();
bool useTexStorrage = extensions->isTextureStorageEnabled;
GLenum sizedInternalFormat = 0;
if(useTexStorrage)
@@ -2491,7 +2485,7 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image*
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
// select the internalFormat required for the texture.
bool compressed_image = isCompressedInternalFormat((GLenum)image->getPixelFormat());
@@ -2678,9 +2672,9 @@ bool Texture::isHardwareMipmapGenerationEnabled(const State& state) const
if (_useHardwareMipMapGeneration)
{
unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
if (extensions->isGenerateMipMapSupported())
if (extensions->isGenerateMipMapSupported)
{
return true;
}
@@ -2705,11 +2699,12 @@ Texture::GenerateMipmapMode Texture::mipmapBeforeTexImage(const State& state, bo
#else
FBOExtensions* fbo_ext = FBOExtensions::instance(state.getContextID(),true);
const GL2Extensions* tex_ext = state.get<GL2Extensions>();
bool useGenerateMipMap = fbo_ext->isSupported() && fbo_ext->glGenerateMipmap;
if (useGenerateMipMap)
{
if (Texture::getExtensions(state.getContextID(),true)->getPreferGenerateMipmapSGISForPowerOfTwo())
if (tex_ext->preferGenerateMipmapSGISForPowerOfTwo)
{
int width = getTextureWidth();
int height = getTextureHeight();
@@ -2823,6 +2818,7 @@ void Texture::releaseGLObjects(State* state) const
}
}
#if 0
Texture::Extensions* Texture::getExtensions(unsigned int contextID,bool createIfNotInitalized)
{
if (!s_extensions[contextID] && createIfNotInitalized) s_extensions[contextID] = new Extensions(contextID);
@@ -2960,6 +2956,6 @@ Texture::Extensions::Extensions(unsigned int contextID)
OSG_DEBUG<<"Texture::Extensions::Extensionts() _isTextureStorageEnabled = "<<_isTextureStorageEnabled<<std::endl;
}
#endif
}

View File

@@ -277,11 +277,8 @@ void Texture1D::applyTexImage1D(GLenum target, Image* image, State& state, GLsiz
if (!image || !image->data())
return;
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
// get extension object
const GL2Extensions* extensions = state.get<GL2Extensions>();
// compute the internal texture format, this set the _internalFormat to an appropriate value.
computeInternalFormat();
@@ -290,10 +287,10 @@ void Texture1D::applyTexImage1D(GLenum target, Image* image, State& state, GLsiz
bool compressed = isCompressedInternalFormat(_internalFormat);
//Rescale if resize hint is set or NPOT not supported or dimension exceeds max size
if( _resizeNonPowerOfTwoHint || !extensions->isNonPowerOfTwoTextureSupported(_min_filter) || inwidth > extensions->maxTextureSize() )
if( _resizeNonPowerOfTwoHint || !extensions->isNonPowerOfTwoTextureSupported(_min_filter) || inwidth > extensions->maxTextureSize )
{
// this is not thread safe... should really create local image data and rescale to that as per Texture2D.
image->ensureValidSizeForTexturing(extensions->maxTextureSize());
image->ensureValidSizeForTexturing(extensions->maxTextureSize);
}
glPixelStorei(GL_UNPACK_ALIGNMENT,image->getPacking());

View File

@@ -225,10 +225,10 @@ void Texture2DArray::apply(State& state) const
ElapsedTime elapsedTime(&(tom->getApplyTime()));
tom->getNumberApplied()++;
const Extensions* extensions = getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
// if not supported, then return
if (!extensions->isTexture2DArraySupported() || !extensions->isTexture3DSupported())
if (!extensions->isTexture2DArraySupported || !extensions->isTexture3DSupported)
{
OSG_WARN<<"Warning: Texture2DArray::apply(..) failed, 2D texture arrays are not support by OpenGL driver."<<std::endl;
return;
@@ -367,10 +367,10 @@ void Texture2DArray::apply(State& state) const
}
}
const Texture::Extensions* texExtensions = Texture::getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
// source images have no mipmamps but we could generate them...
if( _min_filter != LINEAR && _min_filter != NEAREST && !_images[0]->isMipmap() &&
_useHardwareMipMapGeneration && texExtensions->isGenerateMipMapSupported() )
_useHardwareMipMapGeneration && extensions->isGenerateMipMapSupported )
{
_numMipmapLevels = Image::computeNumberOfMipmapLevels( _textureWidth, _textureHeight );
generateMipmap( state );
@@ -434,9 +434,7 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
const Texture::Extensions* texExtensions = Texture::getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
GLenum target = GL_TEXTURE_2D_ARRAY_EXT;
// compute the internal texture format, this set the _internalFormat to an appropriate value.
@@ -447,7 +445,7 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL
bool compressed_image = isCompressedInternalFormat((GLenum)image->getPixelFormat());
// if the required layer is exceeds the maximum allowed layer sizes
if (indepth > extensions->maxLayerCount())
if (indepth > extensions->maxLayerCount)
{
// we give a warning and do nothing
OSG_WARN<<"Warning: Texture2DArray::applyTexImage2DArray_subload(..) the given layer number exceeds the maximum number of supported layers."<<std::endl;
@@ -455,10 +453,10 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL
}
//Rescale if resize hint is set or NPOT not supported or dimensions exceed max size
if( _resizeNonPowerOfTwoHint || !texExtensions->isNonPowerOfTwoTextureSupported(_min_filter)
|| inwidth > extensions->max2DSize()
|| inheight > extensions->max2DSize())
image->ensureValidSizeForTexturing(extensions->max2DSize());
if( _resizeNonPowerOfTwoHint || !extensions->isNonPowerOfTwoTextureSupported(_min_filter)
|| inwidth > extensions->max2DSize
|| inheight > extensions->max2DSize)
image->ensureValidSizeForTexturing(extensions->max2DSize);
// image size or format has changed, this is not allowed, hence return
if (image->s()!=inwidth ||
@@ -475,7 +473,7 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL
#endif
bool useHardwareMipmapGeneration =
!image->isMipmap() && _useHardwareMipMapGeneration && texExtensions->isGenerateMipMapSupported();
!image->isMipmap() && _useHardwareMipMapGeneration && extensions->isGenerateMipMapSupported;
// if no special mipmapping is required, then
if( _min_filter == LINEAR || _min_filter == NEAREST || useHardwareMipmapGeneration )
@@ -584,7 +582,7 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL
void Texture2DArray::copyTexSubImage2DArray(State& state, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height )
{
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
// get the texture object for the current contextID.
TextureObject* textureObject = getTextureObject(contextID);
@@ -616,7 +614,7 @@ void Texture2DArray::allocateMipmap(State& state) const
if (textureObject && _textureWidth != 0 && _textureHeight != 0 && _textureDepth != 0)
{
const Extensions* extensions = getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
int safeSourceFormat = _sourceFormat ? _sourceFormat : _internalFormat;
@@ -674,133 +672,3 @@ void Texture2DArray::allocateMipmap(State& state) const
state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this);
}
}
typedef buffered_value< ref_ptr<Texture2DArray::Extensions> > BufferedExtensions;
static BufferedExtensions s_extensions;
Texture2DArray::Extensions* Texture2DArray::getExtensions(unsigned int contextID,bool createIfNotInitalized)
{
if (!s_extensions[contextID] && createIfNotInitalized) s_extensions[contextID] = new Extensions(contextID);
return s_extensions[contextID].get();
}
void Texture2DArray::setExtensions(unsigned int contextID,Extensions* extensions)
{
s_extensions[contextID] = extensions;
}
Texture2DArray::Extensions::Extensions(unsigned int contextID)
{
setupGLExtensions(contextID);
}
Texture2DArray::Extensions::Extensions(const Extensions& rhs):
Referenced()
{
_isTexture3DSupported = rhs._isTexture3DSupported;
_isTexture2DArraySupported = rhs._isTexture2DArraySupported;
_max2DSize = rhs._max2DSize;
_maxLayerCount = rhs._maxLayerCount;
_glTexImage3D = rhs._glTexImage3D;
_glTexSubImage3D = rhs._glTexSubImage3D;
_glCopyTexSubImage3D = rhs._glCopyTexSubImage3D;
_glCompressedTexImage3D = rhs._glCompressedTexImage3D;
_glCompressedTexSubImage3D = rhs._glCompressedTexSubImage3D;;
}
void Texture2DArray::Extensions::lowestCommonDenominator(const Extensions& rhs)
{
if (!rhs._isTexture3DSupported) _isTexture3DSupported = false;
if (!rhs._isTexture2DArraySupported) _isTexture2DArraySupported = false;
if (rhs._max2DSize<_max2DSize) _max2DSize = rhs._max2DSize;
if (rhs._maxLayerCount<_maxLayerCount) _maxLayerCount = rhs._maxLayerCount;
if (!rhs._glTexImage3D) _glTexImage3D = 0;
if (!rhs._glTexSubImage3D) _glTexSubImage3D = 0;
if (!rhs._glCompressedTexImage3D) _glTexImage3D = 0;
if (!rhs._glCompressedTexSubImage3D) _glTexSubImage3D = 0;
if (!rhs._glCopyTexSubImage3D) _glCopyTexSubImage3D = 0;
}
void Texture2DArray::Extensions::setupGLExtensions(unsigned int contextID)
{
_isTexture3DSupported = OSG_GL3_FEATURES ||
isGLExtensionSupported(contextID,"GL_EXT_texture3D") ||
strncmp((const char*)glGetString(GL_VERSION),"1.2",3)>=0;
_isTexture2DArraySupported = OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_EXT_texture_array");
_max2DSize = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &_max2DSize);
_maxLayerCount = 0;
glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS_EXT, &_maxLayerCount);
setGLExtensionFuncPtr(_glTexImage3D, "glTexImage3D","glTexImage3DEXT");
setGLExtensionFuncPtr(_glTexSubImage3D, "glTexSubImage3D","glTexSubImage3DEXT");
setGLExtensionFuncPtr(_glCompressedTexImage3D, "glCompressedTexImage3D","glCompressedTexImage3DARB");
setGLExtensionFuncPtr(_glCompressedTexSubImage3D, "glCompressedTexSubImage3D","glCompressedTexSubImage3DARB");
setGLExtensionFuncPtr(_glCopyTexSubImage3D, "glCopyTexSubImage3D","glCopyTexSubImage3DEXT");
}
void Texture2DArray::Extensions::glTexImage3D( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) const
{
if (_glTexImage3D)
{
_glTexImage3D( target, level, internalFormat, width, height, depth, border, format, type, pixels);
}
else
{
OSG_WARN<<"Error: glTexImage3D not supported by OpenGL driver"<<std::endl;
}
}
void Texture2DArray::Extensions::glTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) const
{
if (_glTexSubImage3D)
{
_glTexSubImage3D( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
}
else
{
OSG_WARN<<"Error: glTexSubImage3D not supported by OpenGL driver"<<std::endl;
}
}
void Texture2DArray::Extensions::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) const
{
if (_glCompressedTexImage3D)
{
_glCompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
}
else
{
OSG_WARN<<"Error: glCompressedTexImage3D not supported by OpenGL driver"<<std::endl;
}
}
void Texture2DArray::Extensions::glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data ) const
{
if (_glCompressedTexSubImage3D)
{
_glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
}
else
{
OSG_WARN<<"Error: glCompressedTexImage2D not supported by OpenGL driver"<<std::endl;
}
}
void Texture2DArray::Extensions::glCopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) const
{
if (_glCopyTexSubImage3D)
{
_glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
}
else
{
OSG_WARN<<"Error: glCopyTexSubImage3D not supported by OpenGL driver"<<std::endl;
}
}

View File

@@ -86,8 +86,8 @@ void Texture2DMultisample::apply(State& state) const
{
// current OpenGL context.
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
if (!extensions->isTextureMultisampledSupported())
const GL2Extensions* extensions = state.get<GL2Extensions>();
if (!extensions->isTextureMultisampledSupported)
{
OSG_INFO<<"Texture2DMultisample not supoorted."<<std::endl;
return;

View File

@@ -52,7 +52,7 @@ Texture3D::Texture3D(const Texture3D& text,const CopyOp& copyop):
}
Texture3D::~Texture3D()
{
{
setImage(NULL);
}
@@ -141,13 +141,11 @@ void Texture3D::setImage(Image* image)
void Texture3D::computeRequiredTextureDimensions(State& state, const osg::Image& image,GLsizei& inwidth, GLsizei& inheight,GLsizei& indepth, GLsizei& numMipmapLevels) const
{
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
const Texture::Extensions* texExtensions = Texture::getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
int width,height,depth;
if( !_resizeNonPowerOfTwoHint && texExtensions->isNonPowerOfTwoTextureSupported(_min_filter) )
if( !_resizeNonPowerOfTwoHint && extensions->isNonPowerOfTwoTextureSupported(_min_filter) )
{
width = image.s();
height = image.t();
@@ -161,15 +159,15 @@ void Texture3D::computeRequiredTextureDimensions(State& state, const osg::Image&
}
// cap the size to what the graphics hardware can handle.
if (width>extensions->maxTexture3DSize()) width = extensions->maxTexture3DSize();
if (height>extensions->maxTexture3DSize()) height = extensions->maxTexture3DSize();
if (depth>extensions->maxTexture3DSize()) depth = extensions->maxTexture3DSize();
if (width>extensions->maxTexture3DSize) width = extensions->maxTexture3DSize;
if (height>extensions->maxTexture3DSize) height = extensions->maxTexture3DSize;
if (depth>extensions->maxTexture3DSize) depth = extensions->maxTexture3DSize;
inwidth = width;
inheight = height;
indepth = depth;
bool useHardwareMipMapGeneration = !image.isMipmap() && _useHardwareMipMapGeneration && texExtensions->isGenerateMipMapSupported();
bool useHardwareMipMapGeneration = !image.isMipmap() && _useHardwareMipMapGeneration && extensions->isGenerateMipMapSupported;
if( _min_filter == LINEAR || _min_filter == NEAREST || useHardwareMipMapGeneration )
{
@@ -210,9 +208,9 @@ void Texture3D::apply(State& state) const
ElapsedTime elapsedTime(&(tom->getApplyTime()));
tom->getNumberApplied()++;
const Extensions* extensions = getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
if (!extensions->isTexture3DSupported())
if (!extensions->isTexture3DSupported)
{
OSG_WARN<<"Warning: Texture3D::apply(..) failed, 3D texturing is not support by OpenGL driver."<<std::endl;
return;
@@ -367,8 +365,7 @@ void Texture3D::applyTexImage3D(GLenum target, Image* image, State& state, GLsiz
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
const Texture::Extensions* texExtensions = Texture::getExtensions(contextID,true);
const GL2Extensions* extensions = GL2Extensions::Get(contextID,true);
// compute the internal texture format, this set the _internalFormat to an appropriate value.
computeInternalFormat();
@@ -384,18 +381,18 @@ void Texture3D::applyTexImage3D(GLenum target, Image* image, State& state, GLsiz
}
//Rescale if resize hint is set or NPOT not supported or dimensions exceed max size
if( _resizeNonPowerOfTwoHint || !texExtensions->isNonPowerOfTwoTextureSupported(_min_filter)
|| inwidth > extensions->maxTexture3DSize()
|| inheight > extensions->maxTexture3DSize()
|| indepth > extensions->maxTexture3DSize() )
image->ensureValidSizeForTexturing(extensions->maxTexture3DSize());
if( _resizeNonPowerOfTwoHint || !extensions->isNonPowerOfTwoTextureSupported(_min_filter)
|| inwidth > extensions->maxTexture3DSize
|| inheight > extensions->maxTexture3DSize
|| indepth > extensions->maxTexture3DSize )
image->ensureValidSizeForTexturing(extensions->maxTexture3DSize);
glPixelStorei(GL_UNPACK_ALIGNMENT,image->getPacking());
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
glPixelStorei(GL_UNPACK_ROW_LENGTH,image->getRowLength());
#endif
bool useHardwareMipMapGeneration = !image->isMipmap() && _useHardwareMipMapGeneration && texExtensions->isGenerateMipMapSupported();
bool useHardwareMipMapGeneration = !image->isMipmap() && _useHardwareMipMapGeneration && extensions->isGenerateMipMapSupported;
if( _min_filter == LINEAR || _min_filter == NEAREST || useHardwareMipMapGeneration )
{
@@ -489,7 +486,7 @@ void Texture3D::applyTexImage3D(GLenum target, Image* image, State& state, GLsiz
void Texture3D::copyTexSubImage3D(State& state, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height )
{
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
// get the texture object for the current contextID.
TextureObject* textureObject = getTextureObject(contextID);
@@ -523,7 +520,7 @@ void Texture3D::allocateMipmap(State& state) const
if (textureObject && _textureWidth != 0 && _textureHeight != 0 && _textureDepth != 0)
{
const Extensions* extensions = getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
// bind texture
textureObject->bind();
@@ -563,6 +560,7 @@ void Texture3D::allocateMipmap(State& state) const
}
}
#if 0
typedef buffered_value< ref_ptr<Texture3D::Extensions> > BufferedExtensions;
static BufferedExtensions s_extensions;
@@ -630,3 +628,4 @@ void Texture3D::Extensions::setupGLExtensions(unsigned int contextID)
setGLExtensionFuncPtr(glCopyTexSubImage3D,"glCopyTexSubImage3D","glCopyTexSubImage3DEXT");
}
#endif

View File

@@ -106,7 +106,7 @@ void TextureBuffer::apply(State& state) const
TextureObject* textureObject = getTextureObject(contextID);
TextureBufferObject* textureBufferObject = _textureBufferObjects[contextID].get();
if (textureObject)
{
@@ -118,11 +118,11 @@ void TextureBuffer::apply(State& state) const
textureBufferObject->unbindBuffer(GL_TEXTURE_BUFFER_ARB);
_modifiedCount[contextID] = _image->getModifiedCount();
}
textureObject->bind();
textureObject->bind();
if( getTextureParameterDirty(contextID) )
{
const Extensions* extensions = Texture::getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
if (extensions->isBindImageTextureSupported() && _imageAttachment.access!=0)
{
extensions->glBindImageTexture(
@@ -138,11 +138,11 @@ void TextureBuffer::apply(State& state) const
textureObject = generateTextureObject(this, contextID,GL_TEXTURE_BUFFER_ARB);
_textureObjectBuffer[contextID] = textureObject;
textureObject->bind();
textureBufferObject = new TextureBufferObject(contextID,_usageHint);
_textureBufferObjects[contextID] = textureBufferObject;
const Extensions* extensions = Texture::getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
if (extensions->isBindImageTextureSupported() && _imageAttachment.access!=0)
{
extensions->glBindImageTexture(
@@ -151,17 +151,17 @@ void TextureBuffer::apply(State& state) const
_imageAttachment.format!=0 ? _imageAttachment.format : _internalFormat);
}
getTextureParameterDirty(state.getContextID()) = false;
computeInternalFormat();
_textureWidth = _image->s();
textureBufferObject->bindBuffer(GL_TEXTURE_BUFFER_ARB);
textureBufferObject->bufferData( _image.get() );
textureObject->setAllocated(true);
textureBufferObject->unbindBuffer(GL_TEXTURE_BUFFER_ARB);
textureObject->bind();
textureBufferObject->texBuffer(_internalFormat);
_modifiedCount[contextID] = _image->getModifiedCount();
}
else
@@ -176,14 +176,14 @@ void TextureBuffer::apply(State& state) const
void TextureBuffer::bindBufferAs( unsigned int contextID, GLuint target )
{
TextureBufferObject* textureBufferObject = _textureBufferObjects[contextID].get();
TextureBufferObject* textureBufferObject = _textureBufferObjects[contextID].get();
textureBufferObject->bindBuffer(target);
}
void TextureBuffer::unbindBufferAs( unsigned int contextID, GLuint target )
{
TextureBufferObject* textureBufferObject = _textureBufferObjects[contextID].get();
TextureBufferObject* textureBufferObject = _textureBufferObjects[contextID].get();
textureBufferObject->unbindBuffer(target);
}

View File

@@ -308,7 +308,7 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
// update the modified count to show that it is upto date.
getModifiedCount(contextID) = image->getModifiedCount();
@@ -321,7 +321,7 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st
glPixelStorei(GL_UNPACK_ROW_LENGTH,image->getRowLength());
#endif
bool useClientStorage = extensions->isClientStorageSupported() && getClientStorageHint();
bool useClientStorage = extensions->isClientStorageSupported && getClientStorageHint();
if (useClientStorage)
{
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE,GL_TRUE);
@@ -390,7 +390,7 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State&
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
const GL2Extensions* extensions = state.get<GL2Extensions>();
// update the modified count to show that it is upto date.

View File

@@ -147,8 +147,8 @@ void GlyphTexture::apply(osg::State& state) const
}
const Extensions* extensions = getExtensions(contextID,true);
bool generateMipMapSupported = extensions->isGenerateMipMapSupported();
const osg::GL2Extensions* extensions = state.get<osg::GL2Extensions>();
bool generateMipMapSupported = extensions->isGenerateMipMapSupported;
// get the texture object for the current contextID.
TextureObject* textureObject = getTextureObject(contextID);