Cleaned up GL_TEXTURE_BUFFER_*ARB usage as include/osg/GLDefines now provides the non ARB variants

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14652 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2015-01-06 17:23:26 +00:00
parent 8b384baca9
commit 134b2e506f
3 changed files with 11 additions and 19 deletions

View File

@ -19,14 +19,6 @@
#include <osg/Texture> #include <osg/Texture>
#include <osg/BufferObject> #include <osg/BufferObject>
#ifndef GL_ARB_texture_buffer_object
#define GL_TEXTURE_BUFFER_ARB 0x8C2A
#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B
#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C
#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D
#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E
#endif
namespace osg { namespace osg {
/** Encapsulates OpenGL texture buffer functionality. /** Encapsulates OpenGL texture buffer functionality.
@ -48,7 +40,7 @@ class OSG_EXPORT TextureBuffer : public Texture
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
virtual int compare(const StateAttribute& rhs) const; virtual int compare(const StateAttribute& rhs) const;
virtual GLenum getTextureTarget() const { return GL_TEXTURE_BUFFER_ARB; } virtual GLenum getTextureTarget() const { return GL_TEXTURE_BUFFER; }
/** Sets the texture image. */ /** Sets the texture image. */
void setImage(Image* image); void setImage(Image* image);

View File

@ -50,7 +50,7 @@ class TextureGLModeSet
_textureModeSet.insert(GL_TEXTURE_1D); _textureModeSet.insert(GL_TEXTURE_1D);
_textureModeSet.insert(GL_TEXTURE_2D); _textureModeSet.insert(GL_TEXTURE_2D);
_textureModeSet.insert(GL_TEXTURE_3D); _textureModeSet.insert(GL_TEXTURE_3D);
_textureModeSet.insert(GL_TEXTURE_BUFFER_ARB); _textureModeSet.insert(GL_TEXTURE_BUFFER);
_textureModeSet.insert(GL_TEXTURE_CUBE_MAP); _textureModeSet.insert(GL_TEXTURE_CUBE_MAP);
_textureModeSet.insert(GL_TEXTURE_RECTANGLE_NV); _textureModeSet.insert(GL_TEXTURE_RECTANGLE_NV);

View File

@ -113,9 +113,9 @@ void TextureBuffer::apply(State& state) const
if (_image.valid() && getModifiedCount(contextID) != _image->getModifiedCount()) if (_image.valid() && getModifiedCount(contextID) != _image->getModifiedCount())
{ {
computeInternalFormat(); computeInternalFormat();
textureBufferObject->bindBuffer(GL_TEXTURE_BUFFER_ARB); textureBufferObject->bindBuffer(GL_TEXTURE_BUFFER);
textureBufferObject->bufferSubData(_image.get() ); textureBufferObject->bufferSubData(_image.get() );
textureBufferObject->unbindBuffer(GL_TEXTURE_BUFFER_ARB); textureBufferObject->unbindBuffer(GL_TEXTURE_BUFFER);
_modifiedCount[contextID] = _image->getModifiedCount(); _modifiedCount[contextID] = _image->getModifiedCount();
} }
textureObject->bind(); textureObject->bind();
@ -135,7 +135,7 @@ void TextureBuffer::apply(State& state) const
} }
else if (_image.valid() && _image->data()) else if (_image.valid() && _image->data())
{ {
textureObject = generateTextureObject(this, contextID,GL_TEXTURE_BUFFER_ARB); textureObject = generateTextureObject(this, contextID, GL_TEXTURE_BUFFER);
_textureObjectBuffer[contextID] = textureObject; _textureObjectBuffer[contextID] = textureObject;
textureObject->bind(); textureObject->bind();
@ -154,10 +154,10 @@ void TextureBuffer::apply(State& state) const
computeInternalFormat(); computeInternalFormat();
_textureWidth = _image->s(); _textureWidth = _image->s();
textureBufferObject->bindBuffer(GL_TEXTURE_BUFFER_ARB); textureBufferObject->bindBuffer(GL_TEXTURE_BUFFER);
textureBufferObject->bufferData( _image.get() ); textureBufferObject->bufferData( _image.get() );
textureObject->setAllocated(true); textureObject->setAllocated(true);
textureBufferObject->unbindBuffer(GL_TEXTURE_BUFFER_ARB); textureBufferObject->unbindBuffer(GL_TEXTURE_BUFFER);
textureObject->bind(); textureObject->bind();
textureBufferObject->texBuffer(_internalFormat); textureBufferObject->texBuffer(_internalFormat);
@ -166,7 +166,7 @@ void TextureBuffer::apply(State& state) const
} }
else else
{ {
glBindTexture(GL_TEXTURE_BUFFER_ARB, 0); glBindTexture(GL_TEXTURE_BUFFER, 0);
} }
#else #else
@ -208,15 +208,15 @@ void TextureBuffer::TextureBufferObject::unbindBuffer(GLenum target)
void TextureBuffer::TextureBufferObject::texBuffer(GLenum internalFormat) void TextureBuffer::TextureBufferObject::texBuffer(GLenum internalFormat)
{ {
_extensions->glTexBuffer(GL_TEXTURE_BUFFER_ARB, internalFormat, _id); _extensions->glTexBuffer(GL_TEXTURE_BUFFER, internalFormat, _id);
} }
void TextureBuffer::TextureBufferObject::bufferData( osg::Image* image ) void TextureBuffer::TextureBufferObject::bufferData( osg::Image* image )
{ {
_extensions->glBufferData(GL_TEXTURE_BUFFER_ARB, image->getTotalDataSize(), image->data(), _usageHint); _extensions->glBufferData(GL_TEXTURE_BUFFER, image->getTotalDataSize(), image->data(), _usageHint);
} }
void TextureBuffer::TextureBufferObject::bufferSubData( osg::Image* image ) void TextureBuffer::TextureBufferObject::bufferSubData( osg::Image* image )
{ {
_extensions->glBufferSubData(GL_TEXTURE_BUFFER_ARB, 0, image->getTotalDataSize(), image->data()); _extensions->glBufferSubData(GL_TEXTURE_BUFFER, 0, image->getTotalDataSize(), image->data());
} }