• Advertisement
Sign in to follow this  

glOrtho / glFrustum scale

This topic is 4740 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I have an orthographic view set up such that one unit of movement in object space is equal to moving one pixel on the screen. I need this kind of mapping extended to a perspective view. Is there a way of using glFrustum to set up a perspective view using a similar scale as I was using with glOrtho(0, 720, 0, 576, 576, -576) ? i.e. on the xy plane (where z = 0) moving one unit across in object space would be the same as moving one pixel across the screen. Cheers

Share this post


Link to post
Share on other sites
Advertisement
A 1:1 mapping between vertex coordinates and pixel coordinates doesn't make much sense in perspective projection. Sure you can create a perspective matrix where, on a certain Z-plane, you have a 1:1 mapping, but will the coordinates on any other Z-plane make any sense? What, exactly, are you trying to achieve? If you give us your goal we might be able to give you a better general answer instead of being restricted to a certain way of achieving the goal.

But to answer the question you asked, the following is equivalent to the glOrtho-code you posted, assuming you're drawing on the Z=0 plane only. On any other plane, by the perspective property, you will not have a 1:1 mapping anymore.


glFrustum(0, 720, 0, 576, 1, 2);
glTranslatef(0, 0, -1);

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement