Jump to content
  • Advertisement

Archived

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

LessThanJoe

800x600

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

ok, this is what I think is a simple question...and I hope it is. How would I set it up so that when using glvertex3f I can put in 0, 0, -1 and get the top left of the screen, then put in 800, 600, -1 and get the bottom right. This would make getting some code I''ve written to work as it should far easier. Thanks in advance...

Share this post


Link to post
Share on other sites
Advertisement
This is asked a lot.

glViewport(0, 0, (GLsizei) ScreenWidth, (GLsizei) ScreenHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0f,ScreenWidth,ScreenHeight,0.0f,Near,Far);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

Just plug in -1.0f and 1.0f for near and far, respectively, if you don''t need to use the depth buffer.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!