OpenGL ES 2.0相当于glOrtho()?

Zip*_*ppo 5 opengl-es iphone-sdk-3.0 projection-matrix

在我的iPhone应用程序中,我需要将3D场景投影到屏幕的2D坐标中进行一些计算.我的对象经历了各种旋转,平移和缩放.所以我想我首先需要将顶点与ModelView矩阵相乘,然后我需要将它与正交投影矩阵相乘.

首先是在正确的轨道上?

我有模型视图矩阵,但需要投影矩阵.ES 2.0中是否有glOrtho()等价物?

Ale*_*hyn 13

mat4 projectionMatrix = mat4( 2.0/768.0, 0.0, 0.0, -1.0,
                              0.0, 2.0/1024.0, 0.0, -1.0,
                              0.0, 0.0, -1.0, 0.0,
                              0.0, 0.0, 0.0, 1.0);                        

gl_Position = position;
gl_Position *= rotationMatrix;
gl_Position.x -= translateX;
gl_Position.y -= translateY;
gl_Position *= projectionMatrix;
Run Code Online (Sandbox Code Playgroud)

对于固定的分辨率(我的iPad为1024x768)我使用了这个矩阵,一切都像魅力一样:)这里是完整的描述你需要在你的矩阵中放置什么值:glOrtho.html