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)."

This commit is contained in:
Robert Osfield
2009-02-19 15:57:38 +00:00
parent 055801d57c
commit e1b41a5e1c

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