Commit e4210c68 authored by Robert Menzel's avatar Robert Menzel

added getSize to the bufferobject

parent f96584a2
......@@ -58,6 +58,15 @@ public:
glDeleteBuffers(1, &mObjectName);
}
GLuint mObjectName;
//! has the side effect of binding this buffer.
//! returned value is in bytes
GLsizei getSize( GLenum _asTarget ) {
glBindBuffer( _asTarget, mObjectName );
GLint value;
glGetBufferParameteriv( _asTarget, GL_BUFFER_SIZE, &value );
return value;
}
};
typedef ptr::shared_ptr<BufferObject> SharedBufferObject;
......@@ -94,10 +103,11 @@ public:
* In this case no GL wrapper calls should ever get called until one gets set!
*/
Buffer( SharedBufferObject _pBuffer, GLenum _target )
: mSize(0),
mBuffer( _pBuffer ),
: mBuffer( _pBuffer ),
mTarget(_target)
{}
{
mSize = mBuffer->getSize( _target );
}
virtual ~Buffer(){}
......@@ -114,7 +124,7 @@ public:
// ==================================================================================================== \/
//! the GL buffer can get changed at any time
void setBufferObject( SharedBufferObject _pBuffer ) { mBuffer = _pBuffer; }
void setBufferObject( SharedBufferObject _pBuffer ) { mBuffer = _pBuffer; mSize = mBuffer->getSize( mTarget ); }
// ===================================================================================================== \/
// ============================================================================================ WRAPPERS \/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment