2

I want to render many objects with the same effect.

So I change the transform property and call preparetodraw, e.g.

GLKMatrix4 baseModelViewMatrix = GLKMatrix4MakeTranslation(0.0f, position, -1.0f);
self.effect.transform.modelviewMatrix = baseModelViewMatrix;
[self.effect prepareToDraw];
glDrawElements(GL_TRIANGLES, sizeof(SquareIndices)/sizeof(SquareIndices[0]), GL_UNSIGNED_BYTE, 0);

baseModelViewMatrix = GLKMatrix4MakeTranslation(0.0f, position+2.0f, -1.0f);
self.effect.transform.modelviewMatrix = baseModelViewMatrix;
[self.effect prepareToDraw];
glDrawElements(GL_TRIANGLES, sizeof(SquareIndices)/sizeof(SquareIndices[0]), GL_UNSIGNED_BYTE, 0);

Is this efficient - or is there a better approach? Will this result in extra glUseProgram calls and such?

I have an older shader manager class that I built, but was hoping to use glkit instead.

Thanks in advance for any hints...

OptimisticMonkey
  • 538
  • 4
  • 13

0 Answers0