View Full Version : Is drawing from -1 to 1 only option or there are features to align to resolution?

08-01-2014, 12:38 PM
In opengl is to draw with cordiantes vertical -1 to 1 and horizontal 1 to -1 only way to place objects or is there way to do 2d relative to resolution?
I have tested some formulas to align lines relative to resolution and accuracy is 1 pixel mistake if 1920 pixels resolution and 1920 lines drawn.
So far i have divided 2 by resolution and then testing with small differeneces to find right spot so gpu draws lines with offset and no space between, this does not seem good way to do it , is there alternative to align drawings to pixels?

08-02-2014, 03:35 AM
glOrtho(0.0f, windowWidth, windowHeight, 0.0f, 0.0f, 1.0f);

Note that the Y axis is switched so your Y0 is at the top of the screen and not OpenGL-like in the bottom.

08-03-2014, 08:13 AM
Thanks , got my graph generator decently going.