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:
@@ -782,204 +782,6 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(State* state=0) const;
|
||||
|
||||
/** Encapsulates queries of extension availability, obtains extension
|
||||
* function pointers, and provides convenience wrappers for
|
||||
* calling extension functions. */
|
||||
class OSG_EXPORT Extensions : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
Extensions(unsigned int contextID);
|
||||
|
||||
void setMultiTexturingSupported(bool flag) { _isMultiTexturingSupported=flag; }
|
||||
bool isMultiTexturingSupported() const { return _isMultiTexturingSupported; }
|
||||
|
||||
void setTextureFilterAnisotropicSupported(bool flag) { _isTextureFilterAnisotropicSupported=flag; }
|
||||
bool isTextureFilterAnisotropicSupported() const { return _isTextureFilterAnisotropicSupported; }
|
||||
|
||||
void setTextureSwizzleSupported(bool flag) { _isTextureSwizzleSupported=flag; }
|
||||
bool isTextureSwizzleSupported() const { return _isTextureSwizzleSupported; }
|
||||
|
||||
void setTextureCompressionARBSupported(bool flag) { _isTextureCompressionARBSupported=flag; }
|
||||
bool isTextureCompressionARBSupported() const { return _isTextureCompressionARBSupported; }
|
||||
|
||||
void setTextureCompressionS3TCSupported(bool flag) { _isTextureCompressionS3TCSupported=flag; }
|
||||
bool isTextureCompressionS3TCSupported() const { return _isTextureCompressionS3TCSupported; }
|
||||
|
||||
void setTextureCompressionPVRTC2BPPSupported(bool flag) { _isTextureCompressionPVRTC2BPPSupported=flag; }
|
||||
bool isTextureCompressionPVRTC2BPPSupported() const { return _isTextureCompressionPVRTC2BPPSupported; }
|
||||
|
||||
void setTextureCompressionPVRTC4BPPSupported(bool flag) { _isTextureCompressionPVRTC4BPPSupported=flag; }
|
||||
bool isTextureCompressionPVRTC4BPPSupported() const { return _isTextureCompressionPVRTC4BPPSupported; }
|
||||
|
||||
void setTextureCompressionETCSupported(bool flag) { _isTextureCompressionETCSupported=flag; }
|
||||
bool isTextureCompressionETCSupported() const { return _isTextureCompressionETCSupported; }
|
||||
|
||||
void setTextureCompressionETC2Supported(bool flag) { _isTextureCompressionETC2Supported=flag; }
|
||||
bool isTextureCompressionETC2Supported() const { return _isTextureCompressionETC2Supported; }
|
||||
|
||||
void setTextureCompressionRGTCSupported(bool flag) { _isTextureCompressionRGTCSupported=flag; }
|
||||
bool isTextureCompressionRGTCSupported() const { return _isTextureCompressionRGTCSupported; }
|
||||
|
||||
void setTextureCompressionPVRTCSupported(bool flag) { _isTextureCompressionPVRTCSupported=flag; }
|
||||
bool isTextureCompressionPVRTCSupported() const { return _isTextureCompressionPVRTCSupported; }
|
||||
|
||||
void setTextureMirroredRepeatSupported(bool flag) { _isTextureMirroredRepeatSupported=flag; }
|
||||
bool isTextureMirroredRepeatSupported() const { return _isTextureMirroredRepeatSupported; }
|
||||
|
||||
void setTextureEdgeClampSupported(bool flag) { _isTextureEdgeClampSupported=flag; }
|
||||
bool isTextureEdgeClampSupported() const { return _isTextureEdgeClampSupported; }
|
||||
|
||||
void setTextureBorderClampSupported(bool flag) { _isTextureBorderClampSupported=flag; }
|
||||
bool isTextureBorderClampSupported() const { return _isTextureBorderClampSupported; }
|
||||
|
||||
void setGenerateMipMapSupported(bool flag) { _isGenerateMipMapSupported=flag; }
|
||||
bool isGenerateMipMapSupported() const { return _isGenerateMipMapSupported; }
|
||||
|
||||
void setPreferGenerateMipmapSGISForPowerOfTwo(bool flag) { _preferGenerateMipmapSGISForPowerOfTwo = flag; }
|
||||
bool getPreferGenerateMipmapSGISForPowerOfTwo() const { return _preferGenerateMipmapSGISForPowerOfTwo; }
|
||||
|
||||
void setTextureMultisampledSupported(bool flag) { _isTextureMultisampledSupported=flag; }
|
||||
bool isTextureMultisampledSupported() const { return _isTextureMultisampledSupported; }
|
||||
|
||||
void setShadowSupported(bool flag) { _isShadowSupported = flag; }
|
||||
bool isShadowSupported() const { return _isShadowSupported; }
|
||||
|
||||
void setShadowAmbientSupported(bool flag) { _isShadowAmbientSupported = flag; }
|
||||
bool isShadowAmbientSupported() const { return _isShadowAmbientSupported; }
|
||||
|
||||
void setTextureMaxLevelSupported(bool flag) { _isTextureMaxLevelSupported = flag; }
|
||||
bool isTextureMaxLevelSupported() const { return _isTextureMaxLevelSupported; }
|
||||
|
||||
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; }
|
||||
|
||||
bool isClientStorageSupported() const { return _isClientStorageSupported; }
|
||||
|
||||
bool isNonPowerOfTwoTextureSupported(GLenum filter) const
|
||||
{
|
||||
return (filter==GL_LINEAR || filter==GL_NEAREST) ?
|
||||
_isNonPowerOfTwoTextureNonMipMappedSupported :
|
||||
_isNonPowerOfTwoTextureMipMappedSupported;
|
||||
}
|
||||
|
||||
void setTextureIntegerSupported(bool flag) { _isTextureIntegerEXTSupported=flag; }
|
||||
bool isTextureIntegerSupported() const { return _isTextureIntegerEXTSupported; }
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// ARB_shader_image_load_store
|
||||
void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) const
|
||||
{
|
||||
_glBindImageTexture(unit, texture, level, layered, layer, access, format);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
~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);
|
||||
typedef void (GL_APIENTRY * TexImage2DMultisample)(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
|
||||
typedef void (GL_APIENTRY * TexParameterIivProc)(GLenum target, GLenum pname, const GLint* data);
|
||||
typedef void (GL_APIENTRY * TexParameterIuivProc)(GLenum target, GLenum pname, const GLuint* data);
|
||||
typedef void (GL_APIENTRY * BindImageTextureProc)( GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format );
|
||||
|
||||
CompressedTexImage2DArbProc _glCompressedTexImage2D;
|
||||
CompressedTexSubImage2DArbProc _glCompressedTexSubImage2D;
|
||||
GetCompressedTexImageArbProc _glGetCompressedTexImage;
|
||||
TexImage2DMultisample _glTexImage2DMultisample;
|
||||
TexParameterIivProc _glTexParameterIiv;
|
||||
TexParameterIuivProc _glTexParameterIuiv;
|
||||
|
||||
// ARB_shader_image_load_store
|
||||
BindImageTextureProc _glBindImageTexture;
|
||||
|
||||
// ARB_texture_storage
|
||||
TexStorage2DArbProc _glTexStorage2D;
|
||||
|
||||
bool _isMultiTexturingSupported;
|
||||
bool _isTextureFilterAnisotropicSupported;
|
||||
bool _isTextureSwizzleSupported;
|
||||
bool _isTextureCompressionARBSupported;
|
||||
bool _isTextureCompressionS3TCSupported;
|
||||
bool _isTextureCompressionPVRTC2BPPSupported;
|
||||
bool _isTextureCompressionPVRTC4BPPSupported;
|
||||
bool _isTextureCompressionETCSupported;
|
||||
bool _isTextureCompressionETC2Supported;
|
||||
bool _isTextureCompressionRGTCSupported;
|
||||
bool _isTextureCompressionPVRTCSupported;
|
||||
bool _isTextureMirroredRepeatSupported;
|
||||
bool _isTextureEdgeClampSupported;
|
||||
bool _isTextureBorderClampSupported;
|
||||
bool _isGenerateMipMapSupported;
|
||||
bool _preferGenerateMipmapSGISForPowerOfTwo;
|
||||
bool _isTextureMultisampledSupported;
|
||||
bool _isShadowSupported;
|
||||
bool _isShadowAmbientSupported;
|
||||
bool _isClientStorageSupported;
|
||||
bool _isNonPowerOfTwoTextureMipMappedSupported;
|
||||
bool _isNonPowerOfTwoTextureNonMipMappedSupported;
|
||||
bool _isTextureIntegerEXTSupported;
|
||||
bool _isTextureMaxLevelSupported;
|
||||
bool _isTextureStorageEnabled;
|
||||
|
||||
GLint _maxTextureSize;
|
||||
};
|
||||
|
||||
/** Gets the extension for the specified context. Creates the
|
||||
* Extensions object for that context if it doesn't exist.
|
||||
* Returns NULL if the Extensions object for the context doesn't
|
||||
* exist and the createIfNotInitalized flag is false. */
|
||||
static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized);
|
||||
|
||||
/** Overrides Extensions objects across graphics contexts. Typically
|
||||
* used to ensure the same lowest common denominator of extensions
|
||||
* on systems with different graphics pipes. */
|
||||
static void setExtensions(unsigned int contextID,Extensions* extensions);
|
||||
|
||||
/** Determine whether the given internalFormat is a compressed
|
||||
* image format. */
|
||||
static bool isCompressedInternalFormat(GLint internalFormat);
|
||||
|
||||
Reference in New Issue
Block a user