translating graphic coords to the screen
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?
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.
If you really need exact screencoords you should probably be using orthonormal projection.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement