I'm using SDL and when I try and assign a drawn objects offsets to the position of the mouse (so it moves with mouse) it seems that it works for the x axis but the y axis seems to be inverted. When I move mouse up, Object goes down. When I move mouse down objects goes up. X-axis is fine though.
Is there a way for me to get the x/yaxis of mouse using Opengl? I need them individually. Does opengl allow a way to get the offsets of the mouse like in sdl? Where I can get x using mouse.motion.x and Y using mouse.motion.y?
Help getting Mouse offsets using SDL/Opengl
1 reply to this topic
Members - Reputation: 651
Posted 03 November 2012 - 11:34 AM
OpenGL doesn't have anything to do with the mouse, that is only handled by SDL. SDL gives the mouse position in window coordinates, you need to handle converting the window coordinates to whatever scale openGL is using on your own. By default openGL has the top of the window as positive y, while SDL has it as 0, which explains why it seemed inverted. The easiest way would just be to invert your y axis and be done with it