Archived

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

DDSquad

working with mouse - not in Ortho

Recommended Posts

When you really don''t want ortho, this can''t help.
But when not, read it please:

...
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glOrtho(...);
//Draw all in ortho mode here
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
...

Share this post


Link to post
Share on other sites
If Ive read your post correctly then this should solve your problem..

  
glPushMatrix();
glLoadIdentity();

GLint viewport[4];
GLdouble mvmatrix[16], projmatrix[16];
GLint realy;
glGetIntegerv (GL_VIEWPORT, viewport);
glGetDoublev (GL_MODELVIEW_MATRIX, mvmatrix);
glGetDoublev (GL_PROJECTION_MATRIX, projmatrix);
realy = viewport[3] - (GLint) mouseY - 1;

gluUnProject ((GLdouble) mouseX, (GLdouble) realy, Z,
mvmatrix, projmatrix, viewport, &wx, &wy, &wz);

glPopMatrix();

(the above is a text books example from somewhere (I forget..) but most ppl. on the net use it for making thier own cursors)

Share this post


Link to post
Share on other sites