We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › OpenGL Navigation GUI Always on Top
Page Index Toggle Pages: 1
OpenGL Navigation GUI Always on Top? (Read 4317 times)
OpenGL Navigation GUI Always on Top?
Sep 3rd, 2007, 5:51am
 
Hi there,
Just thought I'd probe your collective minds for a moment.

I'm searching for a way to overlay a GUI on top of an OpenGL application.  I've noticed that many of the GUI libraries break when dealing with OpenGL, so I'm stuck as to what options I have left.

I originally was going to try using ControlP5, and loading the GUI in a popup window, however it doesn't seem to like doing that on my laptop ( works fine on my desktop computer, which is unusual ). using the controlP5.draw() function didn't seem to help either.

Secondly I thought that I could possibly move the OpenGL objects back on the z axis and draw on top of them, which *does* seem to work, and I suppose I could use this as a last ditch effort...

Was just wondering if there was a way to *force* something to always display on top of everything.  Thanks in advance!

- Anthony.
Re: OpenGL Navigation GUI Always on Top?
Reply #1 - Sep 3rd, 2007, 10:02am
 
There is a way to clear the depth inforation in GL, so that anythig drawn after will be on top:

Code:
import javax.media.opengl.*;

//...

void draw()
{
// draw your 3D stuff

GL gl=((PGraphicsOpenGL)g).beginGL();
gl.glClear(GL.GL_DEPTH_BUFFER_BIT);
((PGraphicsOpenGL)g).endGL();

//draw the UI
}
Re: OpenGL Navigation GUI Always on Top?
Reply #2 - Sep 3rd, 2007, 10:04am
 
Quote:
There is a way to clear the depth inforation in GL, so that anythig drawn after will be on top:

Code:
import javax.media.opengl.*;

//...

void draw()
{
// draw your 3D stuff

GL gl=((PGraphicsOpenGL)g).beginGL();
gl.glClear(GL.GL_DEPTH_BUFFER_BIT);
((PGraphicsOpenGL)g).endGL();

//draw the UI
}


Excellent, thankyou! I will try this later on tonight!
Thankyou very much for the quick reply!
Re: OpenGL Navigation GUI Always on Top?
Reply #3 - Sep 4th, 2007, 1:53pm
 
Thankyou,
that works for controlP5 and Interfascia, thankyou.

Though now I've come up with another problem.  I'm wanting to create a semi-dynamic navigation structure, causing me some stress.  hopefully will get there eventually.
Re: OpenGL Navigation GUI Always on Top?
Reply #4 - Oct 1st, 2007, 6:20am
 
Is there any way to get this working in conjunction with additive blending ?

In other words, have the 3d elements with the prettyness, and the GUI elements isolated from the blending
Re: OpenGL Navigation GUI Always on Top?
Reply #5 - Oct 3rd, 2007, 2:49am
 
Similar to clearing the depth buffer, you can turn off your blending before you draw the interface on top:

import javax.media.opengl.*;

//...

void draw()
{
 // draw your 3D stuff

 GL gl=((PGraphicsOpenGL)g).beginGL();
 gl.glDisable(GL.GL_BLEND); //turns off blending
 ((PGraphicsOpenGL)g).endGL();

 //draw the UI
}
Re: OpenGL Navigation GUI Always on Top?
Reply #6 - Jun 10th, 2008, 9:49pm
 
Is there a similar way to do this with P3D?
Re: OpenGL Navigation GUI Always on Top?
Reply #7 - Jun 20th, 2008, 5:29pm
 
what if you draw the interface in a pop up window? I'm not having any luck with turn off blending. the pop up window works fine both in P3D and OPENGL but the main window only works in P3D. in OPENGL It looks like my object never loads. I would just working P3D but I need to use OPENGL. Any ideas?
Page Index Toggle Pages: 1