Added ability to initializer GL vertex array object id with Geometry::compileGLObjects().

Improved the handling of buffer object state when not using VAO's
This commit is contained in:
Robert Osfield
2016-07-18 20:09:22 +01:00
parent 14d1483b06
commit 4d8a29b987
4 changed files with 124 additions and 45 deletions

View File

@@ -238,6 +238,8 @@ class OSG_EXPORT Geometry : public Drawable
bool _containsDeprecatedData;
virtual VertexArrayState* setUpVertexArrayState(RenderInfo& renderInfo, bool usingVBOs) const;
public:

View File

@@ -155,7 +155,7 @@ public:
void setCurrentVertexBufferObject(osg::GLBufferObject* vbo) { _currentVBO = vbo; }
const GLBufferObject* getCurrentVertexBufferObject() { return _currentVBO; }
GLBufferObject* getCurrentVertexBufferObject() { return _currentVBO; }
inline void bindVertexBufferObject(osg::GLBufferObject* vbo)
{
if (vbo)
@@ -177,13 +177,13 @@ public:
void setCurrentElementBufferObject(osg::GLBufferObject* ebo) { _currentEBO = ebo; }
const GLBufferObject* getCurrentElementBufferObject() { return _currentEBO; }
GLBufferObject* getCurrentElementBufferObject() { return _currentEBO; }
inline void bindElementBufferObject(osg::GLBufferObject* ebo)
{
if (ebo)
{
if (ebo == _currentEBO) return;
//if (ebo == _currentEBO) return;
if (ebo->isDirty()) ebo->compileBuffer();
else ebo->bindBuffer();
_currentEBO = ebo;
@@ -193,7 +193,7 @@ public:
inline void unbindElementBufferObject()
{
if (!_currentEBO) return;
//if (!_currentEBO) return;
_ext->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,0);
_currentEBO = 0;
}