corrected centering in ortho

This commit is contained in:
codeanticode
2012-04-26 14:23:32 +00:00
parent 0ae2664ef4
commit 97754afccf
@@ -3697,15 +3697,18 @@ public class PGraphicsOpenGL extends PGraphics {
// Flushing geometry with a different perspective configuration.
flush();
left -= width/2;
right -= width/2;
float halfw = 0.5f * (right - left);
float halfh = 0.5f * (top - bottom);
bottom -= height/2;
top -= height/2;
near += cameraDepth;
far += cameraDepth;
left -= halfw;
right -= halfw;
bottom -= halfh;
top -= halfh;
// near += cameraDepth;
// far += cameraDepth;
float x = 2.0f / (right - left);
float y = 2.0f / (top - bottom);
float z = -2.0f / (far - near);