Commit 55ee4612 authored by Christopher Tenter's avatar Christopher Tenter

support for immediate mode in new renderer

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15868 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 5fc620e2
...@@ -368,29 +368,37 @@ void Renderer::bindObjectRenderStates(ACG::RenderObject* _obj) ...@@ -368,29 +368,37 @@ void Renderer::bindObjectRenderStates(ACG::RenderObject* _obj)
void Renderer::drawObject(ACG::RenderObject* _obj) void Renderer::drawObject(ACG::RenderObject* _obj)
{ {
// indexed drawing? if (_obj->numIndices)
bool noIndices = true; {
if (_obj->indexBuffer || _obj->sysmemIndexBuffer) // indexed drawing?
noIndices = false; bool noIndices = true;
if (_obj->indexBuffer || _obj->sysmemIndexBuffer)
noIndices = false;
glPolygonMode(GL_FRONT_AND_BACK, _obj->fillMode); glPolygonMode(GL_FRONT_AND_BACK, _obj->fillMode);
if (noIndices) if (noIndices)
glDrawArrays(_obj->primitiveMode, _obj->indexOffset, _obj->numIndices); glDrawArrays(_obj->primitiveMode, _obj->indexOffset, _obj->numIndices);
else else
{
// ------------------------------------------
// index offset stuff not tested
int indexSize = 0;
switch (_obj->indexType)
{ {
case GL_UNSIGNED_INT: indexSize = 4; break; // ------------------------------------------
case GL_UNSIGNED_SHORT: indexSize = 2; break; // index offset stuff not tested
default: indexSize = 1; break; int indexSize = 0;
} switch (_obj->indexType)
{
case GL_UNSIGNED_INT: indexSize = 4; break;
case GL_UNSIGNED_SHORT: indexSize = 2; break;
default: indexSize = 1; break;
}
glDrawElements(_obj->primitiveMode, _obj->numIndices, _obj->indexType, glDrawElements(_obj->primitiveMode, _obj->numIndices, _obj->indexType,
((const char*)_obj->sysmemIndexBuffer) + _obj->indexOffset * indexSize); ((const char*)_obj->sysmemIndexBuffer) + _obj->indexOffset * indexSize);
}
}
else
{
// user defined draw-call
_obj->executeImmediateMode();
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment