# glOrtho / glFrustum scale

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

## 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 on other sites
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);

1. 1
Rutin
68
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 21
• 10
• 33
• ### Forum Statistics

• Total Topics
633438
• Total Posts
3011880
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!