Android. OpenGL ES draw screen size square in ortho projection

别来无恙 提交于 2019-12-25 14:49:13

问题


I'm new in openGL ES. I read simple tutorials but i have problem with setup Ortho and draw screen size square. Could you provide simple code as example ?


回答1:


A nice usage of the orthographic projection is that you can specify how big influence a single float will have in your application when you're setting your vertex data.

For example, consider this explanation:

float right = 5.0f
float top = 4.0f
glOrthof(0.0f, right, 0.0f, top);

In the image above; an object that has a quad (built from triangles) whose size is equal to 1 also corresponds to one of the squares.

Shortly, it doesn't matter which values you pass into the glOrtho() height and right arguments as long as you are setting correct float values in your vertices, which should correspond to one square.



来源:https://stackoverflow.com/questions/6735411/android-opengl-es-draw-screen-size-square-in-ortho-projection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!