OpenGL ES perspective projection
Posted
by
TimeManx
on Stack Overflow
See other posts from Stack Overflow
or by TimeManx
Published on 2012-09-19T03:35:34Z
Indexed on
2012/09/19
3:37 UTC
Read the original article
Hit count: 139
I'm having a hard time understanding how glFrustum
& gluPerspective
work. I understand the concept of perspective projection but the functions aren't behaving how I expect them to.
For example, if I set the frustum this way
glFrustumf(0, 10, 0, 10, 1, 100)
and have a rectangle at points
0, 0, 1,
0, 10, 1,
10, 10, 1,
10, 0, 1
then the rectangle is drawn with its left edge at -5 & right edge at 5, so the left half of the rectangle isn't visible. And if x
is translated, I'd expect y
to be too. But that doesn't happen either.
In whatever examples I've seen, the coordinates for the projection matrix are taken as
glFrustumf(-10, 10, -10, 10, 1, 100)
but either way, whatever part is shown should be dependent on the rectangle's coordinates, right?
© Stack Overflow or respective owner