Inverted Y axis for viewed object

Started by Galve, July 30, 2011, 07:47:07

Previous topic - Next topic

Galve

Ok so I am basically making a simple program that draws a quad to the screen and move the quad with my mouse instead of keys. Everything seems to work other than the display of the Y axis. What I mean by this is that when I move the quad left and right it moves correctly, but up and down is inverted. The x,y coords are correct for both the quad and the mouse.. at least while printing them out they both show the same.. which is what I wanted. It's just visually that the quad shows inverted on the Y axis.

I'm sure this is something I'm missing when using opengl. Im a very new programmer to opengl and LWJGL.

Here is my code: http://pastebin.com/kacntfVw

Edit: I did notice that after really looking at the code that the mouse coords start at the bottom left corner of the screen while the opengl coords start at the top left .. which would cause what I'm running into. So now the question is how do I fix this issue?


Thanks in advanced

Galve

Ok, So after hours of tinkering and some help from a fiend of mine I figured out what I needed to do .. Basically I had to change the orientation of the orth view.. from GL11.glOrtho(0, 800, 600, 0, 1, -1); to GL11.glOrtho(0, 800, 0, 600, 1, -1); which made the mouse coords and the displayed object match correctly..