Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Mapping object coords to window coords

This topic is 6468 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

This is a bit hard to explain. As far as i know, in OGL, the coord system is like this: Y ^ | | | | -----------> X / / / Z What is the "ratio" of object coords to window coords. Example when using glTranslatef(x, y, z) if I replaced it with glTranslatef(1.0, 1.0, 1.0) where is that coord if you were representing them in windows coords?, ie, in pixels?

Share this post

Link to post
Share on other sites
It all depends on how you set up your projection.

Imagine you set up an orthographic projection with the highs and lows at 0,0 640,480. When you use a window of that size there will be a direct mapping between the world coords and the screen coords.

Correct me if I''m wrong

Paul Groves
pauls opengl page

Share this post

Link to post
Share on other sites
I meant using perspective projection not ortho.. but you are on the right track!

Is there a function or something that converts from screen to object coords or vice versa?
So, say I set up perspective proj. with the following:
glViewport(0, 0, SCR_W, SCR_H);
gluPerspective(90, (double)SCR_W/SCR_H, 1, 1000);
where SCR_W & SCR_H are the screen widths and heights respectively.

Now, if I map a texture say, 512x512 pixels onto this, what is the exact ratio?

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

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!