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/
This commit is contained in:
Robert Osfield
2009-02-19 16:00:52 +00:00
parent ced46026e5
commit 7e75fa6a66

View File

@@ -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());
}
}