I have a 3D environment, created with JOGL (I'm using Eclipse) and now I want to create a simple 2D menu that the user can open by pressing "esc".
So I was thinking of using the orthographic projection. As I never used that projection, I tried looking up some sample code, but it just shows a black screen.
GL2 gl = (GL2) drawable.getGL();
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glOrtho(0, 500, 500, 0, 0, 1);
gl.glScalef(1, -1, 1);
gl.glTranslatef(0, -500, 0);
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glColor3d(1.0, 1.0, 0.0);
gl.glBegin(GL2.GL_QUADS);
gl.glVertex2f(125, 125);
gl.glVertex2f(125, 375);
gl.glVertex2f(375, 375);
gl.glVertex2f(375, 125);
gl.glEnd();
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(GL2.GL_MODELVIEW);
This is where I got the example code from: http://www.swiftless.com/tutorials/
Or do I need to search the mistake somewhere else?
Kind regards,
Dave