From Pawel Ksiezopolski, first email: "This submission adds texture buffer object ( defined in GL_ARB_texture_buffer_object extension ) to the osg::Texture* family.

TextureBuffer objects may use osg::Texture::bindToImageUnit(), so GLSL shaders are able to use not only texelFetch() function , but also functions defined in GL_ARB_shader_image_load_store extension : imageLoad(), imageStore(), imageAtomicAdd() etc."

second email: "After a while I found that osg::Texture::applyTexParameters() used with TextureBuffer may cause some OpenGL errors ( applying texture filters and wraps to TextureBuffer makes no sense ) so I fixed it."
This commit is contained in:
Robert Osfield
2013-05-22 12:49:46 +00:00
parent 7bd050e431
commit 1284a0dd40
5 changed files with 378 additions and 1 deletions

View File

@@ -278,6 +278,7 @@ GLBufferObject::Extensions::Extensions(const Extensions& rhs):
_glGetBufferPointerv = rhs._glGetBufferPointerv;
_glBindBufferRange = rhs._glBindBufferRange;
_glBindBufferBase = rhs._glBindBufferBase;
_glTexBuffer = rhs._glTexBuffer;
}
@@ -297,9 +298,11 @@ void GLBufferObject::Extensions::lowestCommonDenominator(const Extensions& rhs)
if (!rhs._glGetBufferParameteriv) _glGetBufferPointerv = rhs._glGetBufferPointerv;
if (!rhs._glBindBufferRange) _glBindBufferRange = rhs._glBindBufferRange;
if (!rhs._glBindBufferBase) _glBindBufferBase = rhs._glBindBufferBase;
if (!rhs._glTexBuffer) _glTexBuffer = rhs._glTexBuffer;
_isPBOSupported = rhs._isPBOSupported;
_isUniformBufferObjectSupported = rhs._isUniformBufferObjectSupported;
_isTBOSupported = rhs._isTBOSupported;
}
void GLBufferObject::Extensions::setupGLExtensions(unsigned int contextID)
@@ -317,9 +320,11 @@ void GLBufferObject::Extensions::setupGLExtensions(unsigned int contextID)
setGLExtensionFuncPtr(_glGetBufferPointerv, "glGetBufferPointerv","glGetBufferPointervARB");
setGLExtensionFuncPtr(_glBindBufferRange, "glBindBufferRange");
setGLExtensionFuncPtr(_glBindBufferBase, "glBindBufferBase");
setGLExtensionFuncPtr(_glTexBuffer, "glTexBuffer","glTexBufferARB" );
_isPBOSupported = OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID,"GL_ARB_pixel_buffer_object");
_isUniformBufferObjectSupported = osg::isGLExtensionSupported(contextID, "GL_ARB_uniform_buffer_object");
_isTBOSupported = osg::isGLExtensionSupported(contextID,"GL_ARB_texture_buffer_object");
}
void GLBufferObject::Extensions::glGenBuffers(GLsizei n, GLuint *buffers) const
@@ -411,6 +416,13 @@ void GLBufferObject::Extensions::glBindBufferBase (GLenum target, GLuint index,
if (_glBindBufferBase) _glBindBufferBase(target, index, buffer);
else OSG_WARN<<"Error: glBindBufferBase not supported by OpenGL driver\n";
}
void GLBufferObject::Extensions::glTexBuffer( GLenum target, GLenum internalFormat, GLuint buffer ) const
{
if ( _glTexBuffer ) _glTexBuffer( target, internalFormat, buffer );
else OSG_WARN<<"Error: glTexBuffer not supported by OpenGL driver\n";
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
// GLBufferObjectSet