Here's what I see as the method for getting 3D objects perspective-transformed to screen:
On update: Create the camera matrix: c = camRotation * camTranslation Create the view matrix by inverting the camera matrix: v = c^-1 Create the projection matrix using the standard perspective projection matrix terms Create view-projection matrix: vp = p * v For each entity Create a model matrix using entity world position, rotation, and scale values Multiply this specific entity's world transform matrix (the model matrix): mvp = vp * m Set mvp as a uniform for vertex shader glDrawElements(...);
- Please offer your advice on whether or not the above structure is sensible.
- What options do I have to reduce the number of draw calls? Merging static geometry into a single vertex list using a common texture atlas seems to be the only option?
- Re the MVP matrix above, why do some sources present the final matrix value as -1, and others as 1? What should I use?
OpenGL wiki page on viewing and transformations
Joe Groff's tutorial on transformation and projection