
Originally Posted by
nupul
Try using gluOrtho2d(-x,x,-y,y) and not just plain gluOrtho()
Following is the relation between gluOrtho2d() and glOrtho().
void GLAPIENTRY
gluOrtho2D(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top)
{
glOrtho(left, right, bottom, top, -1, 1);
}
void GLAPIENTRY
gluOrtho2D(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top)
{
glOrtho(left, right, bottom, top, -1, 1);
}
To copy to clipboard, switch view to plain text mode
For gluOrtho2D() is equivalent to calling glOrtho() with near = −1 and far = 1 .

Originally Posted by
ToddAtWSU
I know how to and successfully retrieve the screen coordinates. But how do I convert these to the grid coordinates? Especially if my grid goes from -x1 to +x2 and -y1 to +y2? I think this shouldn't be too bad if the grid lies entirely in the positive or negative planes, but when the grid overlaps, I have no idea how to approach this.
What do you mean by Grid coordinates?
In case you are looking for a conversion from window coordinates to object coordinates, you can use gluUnproject().
You can get to know about gluUnproject() at gluUnproject man page and Nehe gluUnProject Article
If you aren't using libQGLViewer, then you are looking at wrong place. You should rather refer to Nehe's GameDev Forum for a OpenGL related help.
-Shobhit
Bookmarks