From 7e75fa6a660a95fed41a94efa1b24c259d734773 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 19 Feb 2009 16:00:52 +0000 Subject: [PATCH] From Ruben Smelik, "I've found a (copy-paste?) error in PrimitiveSet.cpp regarding instanced drawing. For DrawElementsUInt and DrawElementsUShort the type argument of glDrawElementsInstanced was set as GL_BYTE instead of GL_UNSIGNED_INT and GL_UNSIGNED_SHORT. I've attached the fixed source file (based on the current SVN head version)." Merged from svn/trunk using: svn merge -r 9795:9796 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osg/ --- src/osg/PrimitiveSet.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/osg/PrimitiveSet.cpp b/src/osg/PrimitiveSet.cpp index 9cfb5ce76..7b50c8e2b 100644 --- a/src/osg/PrimitiveSet.cpp +++ b/src/osg/PrimitiveSet.cpp @@ -180,18 +180,18 @@ void DrawElementsUShort::draw(State& state, bool useVertexBufferObjects) const state.bindElementBufferObject(ebo); if (ebo) { - if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_BYTE, getElementBufferObjectOffset(), _numInstances); + if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_SHORT, getElementBufferObjectOffset(), _numInstances); else glDrawElements(_mode, size(), GL_UNSIGNED_SHORT, getElementBufferObjectOffset()); } else { - if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_BYTE, &front(), _numInstances); + if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_SHORT, &front(), _numInstances); else glDrawElements(_mode, size(), GL_UNSIGNED_SHORT, &front()); } } else { - if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_BYTE, &front(), _numInstances); + if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_SHORT, &front(), _numInstances); else glDrawElements(_mode, size(), GL_UNSIGNED_SHORT, &front()); } } @@ -230,18 +230,18 @@ void DrawElementsUInt::draw(State& state, bool useVertexBufferObjects) const state.bindElementBufferObject(ebo); if (ebo) { - if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_BYTE, getElementBufferObjectOffset(), _numInstances); + if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_INT, getElementBufferObjectOffset(), _numInstances); else glDrawElements(_mode, size(), GL_UNSIGNED_INT, getElementBufferObjectOffset()); } else { - if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_BYTE, &front(), _numInstances); + if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_INT, &front(), _numInstances); else glDrawElements(_mode, size(), GL_UNSIGNED_INT, &front()); } } else { - if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_BYTE, &front(), _numInstances); + if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_INT, &front(), _numInstances); else glDrawElements(_mode, size(), GL_UNSIGNED_INT, &front()); } }