Re: GL units and screen coordinates
Posted by
Wade Walker on
Apr 28, 2011; 7:36pm
URL: https://forum.jogamp.org/GL-units-and-screen-coordinates-tp2826205p2876050.html
Hi Flow,
The problem might be how you're calling gluOrtho2D. It's defined like this
gluOrtho2D(left, right, bottom, top)
where the four arguments are the clipping lines. X coordinates between left and right will be in the viewport, as will y coordinates between bottom and top. So to do a one-to-one mapping you'd want either this
glu.gluOrtho2D(0.0, width, 0.0, height); // origin at bottom left
or this
glu.gluOrtho2D(-width/2.0, width/2.0, -height/2.0, height/2.0); // origin at center