0
votes

I have a square view 100dp X 100dp and I want to do same size square with opengl.

My problem is how I control the size of the square ?

In opengl we have the vertices of the surface, the z coordinate and the angle of the gluPerspective function (fovy)

private float[] vertices = { -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f }

fovy = 45.0

z = ??

How I should calculate the size of my square ???

1
do you just want to have a quad covering the whole view? do you need the perspective projection?Dirk

1 Answers

0
votes

If you want just draw square of the same size probably you need orthographic projection, and setting all transforms to identity.

then size of the square will be equal to it's size on the screen.