LWJGL Forum

Programming => OpenGL => Topic started by: boxsmith on March 25, 2011, 17:20:22

Title: Cabinet projection trouble
Post by: boxsmith on March 25, 2011, 17:20:22
Hi guys! I've been working with Slick2D for a while, and my most recent project has finally pushed me to deal more directly with OpenGL. I'm new to all this, so please be nice. :)

I'm trying to get cabinet projection working, but it's giving me a lot of trouble. I managed to get it to look like cabinet projection like so:

double[] c = {1, 0, 0.05, 0,
      0, 1, 0.5,  0,
      0, 0, -1,   0,
      0, 0, 0,    1};

DoubleBuffer mat = BufferUtils.createDoubleBuffer(16);
mat.put(c).flip();

SlickCallable.enterSafeBlock();
       
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_DEPTH_TEST);
       
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL13.glLoadTransposeMatrix(mat);
GL11.glOrtho(0, window_size_x, window_size_y, 0, 0, 2048);

GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL13.glLoadTransposeMatrix(mat);

...


Then I discovered that the values of zNear and zFar in the glOrtho method seem to play a role in shortening or elongating the scene. How can I prevent them from doing so (that is, how can I ensure that the scene's appearance doesn't change for any value of zNear and zFar)? What exactly do they do? Apparently their purpose is more complicated than I was led to believe. :(
Title: Re: Cabinet projection trouble
Post by: boxsmith on April 06, 2011, 18:17:04
B-b-b-bump.

Help would still very much be appreciated.  ;D