Added GLBufferObject::computeBufferAlignment(..) method to enable buffer entries to be aligned along specified buffer alignment boundaries, currently defaulting to 4.

This commit is contained in:
Robert Osfield
2011-06-14 10:15:12 +00:00
parent 529ea4c94f
commit 6a6c5bccda
2 changed files with 14 additions and 3 deletions

View File

@@ -334,6 +334,13 @@ class OSG_EXPORT GLBufferObject : public Referenced
virtual ~GLBufferObject();
unsigned int computeBufferAlignment(unsigned int pos, unsigned int bufferAlignment) const
{
if (bufferAlignment<2) return pos;
if ((pos%bufferAlignment)==0) return pos;
return ((pos/bufferAlignment)+1)*bufferAlignment;
}
unsigned int _contextID;
GLuint _glObjectID;