From Alexander Sinditskiy, "My changes added support for gltexstorrage2d for texture2d.
Initially I described issue in message: http://forum.openscenegraph.org/viewtopic.php?t=13820 It solves issue with compiling texture using ico from image with mipmaps I added enviroment variable OSG_GL_TEXTURE_STORAGE_ENABLE to control usage of glTexStorage2d. Initially it is disabled. It used only if image have mipmaps. Another issue is converting from internalFormat + type to sized internal format. I created sizedInternalFormats[] struct where sized internal formats are ordered from worse->best. also this struct have commented lines. Commented formats are listed in http://www.opengl.org/wiki/GLAPI/glTexStorage2D but looks like not using in osg." Note from Robert Osfield. Changed the env var control to OSG_GL_TEXTURE_STORAGE and made it's value true by default when the feature is supported by the OpenGL driver. To disable to use of glTexStorage2D use OSG_GL_TEXTURE_STORAGE="OFF" or "DISABLE" git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14275 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
@@ -834,6 +834,9 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
||||
void setMaxTextureSize(GLint maxsize) { _maxTextureSize=maxsize; }
|
||||
GLint maxTextureSize() const { return _maxTextureSize; }
|
||||
|
||||
bool isTexStorage2DSupported() const { return _glTexStorage2D != 0; }
|
||||
bool isTexStorageEnabled() const { return _isTextureStorageEnabled; }
|
||||
|
||||
bool isCompressedTexImage2DSupported() const { return _glCompressedTexImage2D!=0; }
|
||||
bool isCompressedTexSubImage2DSupported() const { return _glCompressedTexSubImage2D!=0; }
|
||||
|
||||
@@ -851,6 +854,11 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
||||
|
||||
bool isBindImageTextureSupported() const { return _glBindImageTexture!=0; }
|
||||
|
||||
void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) const
|
||||
{
|
||||
_glTexStorage2D(target, levels, internalformat, width, height);
|
||||
}
|
||||
|
||||
void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) const
|
||||
{
|
||||
_glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
|
||||
@@ -891,6 +899,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
||||
|
||||
~Extensions() {}
|
||||
|
||||
typedef void (GL_APIENTRY * TexStorage2DArbProc) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRY * CompressedTexImage2DArbProc) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (GL_APIENTRY * CompressedTexSubImage2DArbProc) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (GL_APIENTRY * GetCompressedTexImageArbProc) (GLenum target, GLint level, GLvoid *data);
|
||||
@@ -909,6 +918,9 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
||||
// ARB_shader_image_load_store
|
||||
BindImageTextureProc _glBindImageTexture;
|
||||
|
||||
// ARB_texture_storage
|
||||
TexStorage2DArbProc _glTexStorage2D;
|
||||
|
||||
bool _isMultiTexturingSupported;
|
||||
bool _isTextureFilterAnisotropicSupported;
|
||||
bool _isTextureSwizzleSupported;
|
||||
@@ -933,6 +945,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
||||
bool _isNonPowerOfTwoTextureNonMipMappedSupported;
|
||||
bool _isTextureIntegerEXTSupported;
|
||||
bool _isTextureMaxLevelSupported;
|
||||
bool _isTextureStorageEnabled;
|
||||
|
||||
GLint _maxTextureSize;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user