Skip to content Skip to sidebar Skip to footer

Android. Opengl Es Draw Screen Size Square In Ortho Projection

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 ?

Solution 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:

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

Example image

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.

Post a Comment for "Android. Opengl Es Draw Screen Size Square In Ortho Projection"