Sign in to follow this  

Status panes in front of scene?

This topic is 3662 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am wanting to create a scene and at the same time draw some panes in front of the scene which would allow the user to change certain settings. In doing so I want to ensure that any manipulattion of my scene does not interfere with my panes. Can anyone suggest how to do this or point me towards some examples?

Share this post


Link to post
Share on other sites
Thanks for the reply and for the link.

In reality I am more interested in learning the mechanics of doing it myself for the moment. I am still learning OpenGL and feel that I would rather understand how this is done in OpenGL, before using a ready built solution.

Share this post


Link to post
Share on other sites
I actually just worked this out myself. Here is some psuedocode of what I did:

pushPerspectiveProjection();

while(running)
pushOrthographicProjection();
drawUI();
popProjection();

drawScene();
end

pushOrthographicProjection()
glPushAttrib(GL_TRANSFORM_BIT);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0f, width, 0.0f, height, -1.0f, 1.0f);
glPopAttrib();
end

Share this post


Link to post
Share on other sites
Thanks, this work beautifully. Some actual code, in Java using JOGL, for anyone else who happens to come along this thread:


void pushOrthographicProjection( GL gl ) {
gl.glPushAttrib(GL.GL_TRANSFORM_BIT);
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glOrtho(0.0f, getWidth(), 0.0f, getHeight(), -1.0f, 1.0f);
}

void popOrthographicProjection( GL gl ) {
gl.glPopMatrix();
gl.glPopAttrib();
}

Share this post


Link to post
Share on other sites
Just make sure you don't forget to toggle the matrix mode back before drawing ;)
Quote:
Original post by ajmas

void pushOrthographicProjection( GL gl ) {
gl.glPushAttrib(GL.GL_TRANSFORM_BIT);
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glOrtho(0.0f, getWidth(), 0.0f, getHeight(), -1.0f, 1.0f);
gl.glMatrixMode(GL.GL_MODELVIEW);
}

void popOrthographicProjection( GL gl ) {
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPopAttrib();
}

Share this post


Link to post
Share on other sites

This topic is 3662 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this