Open GL ES 2.0 co-ordinate systems
I want to use Open GL ES 2.0 for a new game, but I have two questions.
Q: The first is how do I set up perspective views in Open GL ES 2.0 - do I need to include Open GL ES 1.0 and use glOrtho, or is there a new way?
Q:开发者_开发技巧 I want to use the 4th quadrant of a Cartesian co-ordinate system for my game and not use -0.5 to +0.5 for values on screen, how once the first question is answered can I achieve this?
Other resources: http://iphonedevelopment.blogspot.com/2009/04/opengl-es-from-ground-up-part-3.html
Thanks
Chris
Q1: You must construct the projection matrix manually, and upload it as a uniform mat4 in your vertex shader.
Q2: Related to Q1, just adjust your modelview and projection matrices to use another coordinate system. Remember that transformation matrices do transform from one space to another, so just find a matrix that transforms from your own space to clip space ([-1,1]^3).
精彩评论