From 229b0b28a8873e091ed06a13749d609b25ad49ec Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 1 Apr 2016 17:32:39 -1000 Subject: [PATCH] glDrawElements fix --- lib/graphicsdev/GL.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/graphicsdev/GL.cpp b/lib/graphicsdev/GL.cpp index 40b1a28..13dcc68 100644 --- a/lib/graphicsdev/GL.cpp +++ b/lib/graphicsdev/GL.cpp @@ -228,7 +228,7 @@ public: void bind(size_t idx, int b); }; -static std::vector DepthInitializer; +static std::vector DepthInitializer; class GLTextureR : public ITextureR { @@ -997,13 +997,15 @@ struct GLCommandQueue : IGraphicsCommandQueue glDrawArrays(currentPrim, cmd.start, cmd.count); break; case Command::Op::DrawIndexed: - glDrawElements(currentPrim, cmd.count, GL_UNSIGNED_INT, (void*)cmd.start); + glDrawElements(currentPrim, cmd.count, GL_UNSIGNED_INT, + reinterpret_cast(cmd.start * 4)); break; case Command::Op::DrawInstances: glDrawArraysInstanced(currentPrim, cmd.start, cmd.count, cmd.instCount); break; case Command::Op::DrawInstancesIndexed: - glDrawElementsInstanced(currentPrim, cmd.count, GL_UNSIGNED_INT, (void*)cmd.start, cmd.instCount); + glDrawElementsInstanced(currentPrim, cmd.count, GL_UNSIGNED_INT, + reinterpret_cast(cmd.start * 4), cmd.instCount); break; case Command::Op::ResolveBindTexture: {