openGL coordinates and Windows mouse coordinates

  • Follow


Hi!
I'm an openGL beginner.

Working under Windows, I've used the glut library to create a simple window.
It seem that, for mouse in this window,  the origin coordinate system is 
in the upper left corner,
while (default) openGL draw the geometry using as origin the lower left 
corner.

So I've used a code like this:

GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);

//wx and wy are the mouse coordinates

x=wx  y=viewport[3]-wy. //mouse windows coordinates converted in 
standard openGL coordinates

My questions are:

this problem of Y axis orientation happen only in Windows or it's under 
Linux and OSX too? It happen because GLUT?
This is important because the application should be portable...

thx,

                    Manuel

0
Reply Manuel 1/6/2006 9:28:28 PM

Manuel wrote:

> this problem of Y axis orientation happen only in Windows or
> it's under Linux and OSX too? It happen because GLUT?
> This is important because the application should be portable...

GLUT's sees mouse coordinates origin in the upper left, OpenGL
has the origin in the lower left. That's it.

Wolfgang Draxinger
-- 

0
Reply Wolfgang 1/6/2006 10:08:20 PM


Wolfgang Draxinger wrote:

> GLUT's sees mouse coordinates origin in the upper left, OpenGL
> has the origin in the lower left. That's it.
> 

Thanks!

                    Manuel
0
Reply Manuel 1/6/2006 10:24:56 PM

2 Replies
156 Views

(page loaded in 2.915 seconds)

Similiar Articles:













7/29/2012 9:33:11 AM


Reply: