2.8 branch: Texture2DMultisample support. This is a backport of r11218, r11229, and r11365 from trunk.

This commit is contained in:
Paul MARTZ
2011-05-22 20:52:41 +00:00
parent 8d20926032
commit 6c6c1183c0
6 changed files with 91 additions and 154 deletions

View File

@@ -331,6 +331,7 @@ namespace osg
**************************************************************************/
class Texture1D;
class Texture2D;
class Texture2DMultisample;
class Texture3D;
class Texture2DArray;
class TextureCubeMap;
@@ -345,6 +346,7 @@ namespace osg
explicit FrameBufferAttachment(RenderBuffer* target);
explicit FrameBufferAttachment(Texture1D* target, int level = 0);
explicit FrameBufferAttachment(Texture2D* target, int level = 0);
explicit FrameBufferAttachment(Texture2DMultisample* target, int level = 0);
explicit FrameBufferAttachment(Texture3D* target, int zoffset, int level = 0);
explicit FrameBufferAttachment(Texture2DArray* target, int layer, int level = 0);
explicit FrameBufferAttachment(TextureCubeMap* target, int face, int level = 0);

View File

@@ -199,6 +199,10 @@
#define GL_TEXTURE_DEPTH 0x8071
#endif
#ifndef GL_TEXTURE_2D_MULTISAMPLE
#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
#endif
// Integer teture extension as in http://www.opengl.org/registry/specs/EXT/texture_integer.txt
#ifndef GL_EXT_texture_integer
#define GL_RGBA32UI_EXT 0x8D70
@@ -579,12 +583,6 @@ class OSG_EXPORT Texture : public osg::StateAttribute
public:
Extensions(unsigned int contextID);
Extensions(const Extensions& rhs);
void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtensions(unsigned int contextID);
void setMultiTexturingSupported(bool flag) { _isMultiTexturingSupported=flag; }
bool isMultiTexturingSupported() const { return _isMultiTexturingSupported; }
@@ -609,6 +607,9 @@ class OSG_EXPORT Texture : public osg::StateAttribute
void setGenerateMipMapSupported(bool flag) { _isGenerateMipMapSupported=flag; }
bool isGenerateMipMapSupported() const { return _isGenerateMipMapSupported; }
void setTextureMultisampledSupported(bool flag) { _isTextureMultisampledSupported=flag; }
bool isTextureMultisampledSupported() const { return _isTextureMultisampledSupported; }
void setShadowSupported(bool flag) { _isShadowSupported = flag; }
bool isShadowSupported() const { return _isShadowSupported; }
@@ -624,10 +625,6 @@ class OSG_EXPORT Texture : public osg::StateAttribute
bool isCompressedTexImage2DSupported() const { return _glCompressedTexImage2D!=0; }
bool isCompressedTexSubImage2DSupported() const { return _glCompressedTexSubImage2D!=0; }
void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) const;
void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei type, const GLvoid *data) const;
void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *data) const;
bool isClientStorageSupported() const { return _isClientStorageSupported; }
bool isNonPowerOfTwoTextureSupported(GLenum filter) const
@@ -640,13 +637,55 @@ class OSG_EXPORT Texture : public osg::StateAttribute
void setTextureIntegerSupported(bool flag) { _isTextureIntegerEXTSupported=flag; }
bool isTextureIntegerSupported() const { return _isTextureIntegerEXTSupported; }
void glTexParameterIiv(GLenum target, GLenum pname, const GLint* data) const;
void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint* data) const;
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);
}
void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) const
{
_glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
}
void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *data) const
{
_glGetCompressedTexImage(target, level, data);
}
void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) const
{
_glTexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
}
void glTexParameterIiv(GLenum target, GLenum pname, const GLint* data) const
{
_glTexParameterIiv(target, pname, data);
}
void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint* data) const
{
_glTexParameterIuiv(target, pname, data);
}
protected:
~Extensions() {}
typedef void (APIENTRY * CompressedTexImage2DArbProc) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * CompressedTexSubImage2DArbProc) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * GetCompressedTexImageArbProc) (GLenum target, GLint level, GLvoid *data);
typedef void (APIENTRY * TexImage2DMultisample)(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
typedef void (APIENTRY * TexParameterIivProc)(GLenum target, GLenum pname, const GLint* data);
typedef void (APIENTRY * TexParameterIuivProc)(GLenum target, GLenum pname, const GLuint* data);
CompressedTexImage2DArbProc _glCompressedTexImage2D;
CompressedTexSubImage2DArbProc _glCompressedTexSubImage2D;
GetCompressedTexImageArbProc _glGetCompressedTexImage;
TexImage2DMultisample _glTexImage2DMultisample;
TexParameterIivProc _glTexParameterIiv;
TexParameterIuivProc _glTexParameterIuiv;
bool _isMultiTexturingSupported;
bool _isTextureFilterAnisotropicSupported;
bool _isTextureCompressionARBSupported;
@@ -655,6 +694,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute
bool _isTextureEdgeClampSupported;
bool _isTextureBorderClampSupported;
bool _isGenerateMipMapSupported;
bool _isTextureMultisampledSupported;
bool _isShadowSupported;
bool _isShadowAmbientSupported;
bool _isClientStorageSupported;
@@ -664,19 +704,6 @@ class OSG_EXPORT Texture : public osg::StateAttribute
GLint _maxTextureSize;
GLint _numTextureUnits;
typedef void (APIENTRY * CompressedTexImage2DArbProc) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * CompressedTexSubImage2DArbProc) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * GetCompressedTexImageArbProc) (GLenum target, GLint level, GLvoid *data);
typedef void (APIENTRY * TexParameterIivProc)(GLenum target, GLenum pname, const GLint* data);
typedef void (APIENTRY * TexParameterIuivProc)(GLenum target, GLenum pname, const GLuint* data);
CompressedTexImage2DArbProc _glCompressedTexImage2D;
CompressedTexSubImage2DArbProc _glCompressedTexSubImage2D;
GetCompressedTexImageArbProc _glGetCompressedTexImage;
TexParameterIivProc _glTexParameterIiv;
TexParameterIuivProc _glTexParameterIuiv;
};
/** Gets the extension for the specified context. Creates the
@@ -710,6 +737,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute
* unless you're implementing a subload callback. */
void applyTexImage2D_subload(State& state, GLenum target, const Image* image, GLsizei width, GLsizei height, GLint inInternalFormat, GLsizei numMipmapLevels) const;
/** Returned by mipmapBeforeTexImage() to indicate what
* mipmapAfterTexImage() should do */
enum GenerateMipmapMode