Jump to content
  • Advertisement
Sign in to follow this  
speedie

translating graphic coords to the screen

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

Say I use GLTranlatef(0,0,-10) and then go to call glVertex3f how would i know what the edge of the screen be and how would i translate that to screen coords such as 512x 300y?

Share this post


Link to post
Share on other sites
Advertisement
If you want to do that you'll need to do a reverse transformation of the GL pipeline operations. Which you don't want to do ;-)

If you really need exact screencoords you should probably be using orthonormal projection.

Share this post


Link to post
Share on other sites
I'm not a hero in maths, but it is possible to get the view matrix from openGL. From there out you can calculate the edges of the view frustum. The frustum is basically the "box" in the 3D world that is visible on your screen. It consists out of 6 planes.
Anyway, it's been a while since I've done that so I couldn't tell you which function you need or how to even calculate it.

But why would you want to know the edges of the screen? If this is for rendering 2D stuff like menu's I'd take a look at glMatrixMode(GL_PROJECTION) and glOrtho.

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!