Fixed the GLBufferObject size computation so that it takes into account padding.

This commit is contained in:
Robert Osfield
2018-04-19 19:41:51 +01:00
parent bf6db4eee7
commit f95fdd4d4e
2 changed files with 13 additions and 6 deletions

View File

@@ -152,6 +152,14 @@ class BufferObjectProfile
class GLBufferObjectSet;
class GLBufferObjectManager;
inline unsigned int computeBufferAlignment(unsigned int pos, unsigned int bufferAlignment)
{
if (bufferAlignment<2) return pos;
if ((pos%bufferAlignment)==0) return pos;
return ((pos/bufferAlignment)+1)*bufferAlignment;
}
class OSG_EXPORT GLBufferObject : public GraphicsObject
{
public:
@@ -235,9 +243,7 @@ class OSG_EXPORT GLBufferObject : public GraphicsObject
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;
return osg::computeBufferAlignment(pos, bufferAlignment);
}
unsigned int _contextID;