Original Post
i want to do the following : 1. get the mouse position through api calls of windows ( x,y ) 2. set the opengl to 2d mode ( gluOrtho2D...) 3. render 2d shapes that may respond to mouse events such as moves or clicks but the problem that the x,y grabbed through windows api is different from the x,y in opengl drawn when 2d mode is set please help me what can i do ? here is a code that demonstrates the problem: inside the windows procedure : - inside the WM_MOUSE_MOVE message: x = LOWORD (lParam); y = HIWORD (lParam); inside the render function of opengl : glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); // set 2D mode glMatrixMode ( GL_PROJECTION ); // push the projection matrix on the stack glPushMatrix(); // load the identity matrix glLoadIdentity(); // set the orthographic projection glOrtho (0, screenWidth, screenHeight, 0, 0, -1); // set modelview matrix glMatrixMode ( GL_MODELVIEW ); // push modelview matrix onto stack glPushMatrix(); // load identity matrix glLoadIdentity(); // here i render 2d rectangle of corners ( UL(10,10) , LR(20,20) ) when the mouse get inside the range of this rect x,y of mouse is not between [10,20] as i see the mouse on the screen inside the range ?... i can't implement a listener and GUI controls if i couldn't solve this problem ? thanks for any help...? [Edited by - eGamer on July 29, 2005 8:52:20 AM]