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 & HelpPrograms › 2D HUD in 3D Program
Page Index Toggle Pages: 1
2D HUD in 3D Program (Read 1000 times)
2D HUD in 3D Program
Apr 22nd, 2008, 4:35am
 
Hey, so I did do several searches looking to see if anyone else posted this already, but I couldn't find any.

I have a program that lets the user move around in a 3D environment. I have it printing data to the screen for debugging and what not, but I would like more contrast between the background and the text. So what I would like to do is make something like a 2D Heads Up Display that's stationary on the screen, while the 3D background moves at will.

Anyone have any ideas?

I couldn't find any way to make a box or rectangle on the screen without it actually being in the 3D environment.

I hope I was clear enough, if I didn't make enough sense just ask and I'll try to make it more clear.

Thank you everyone for whatever help you do offer,
-Paul
Re: 2D HUD in 3D Program
Reply #1 - Apr 22nd, 2008, 11:06am
 
You need to do 2 things really, reset the camera, and clear the z-buffer.

P3D version:
Code:
camera();
for(int i=0;i<((PGraphics3D)g).zbuffer.length;i++)
{
((PGraphics3D)g).zbuffer[i]=Float.MAX_VALUE);
}


OpenGL:
Code:
import javax.media.opengl.*; //at top of file
...
camera();
((PGraphicsOpenGL)g).gl.glClear(GL.GL_DEPTH_BUFFER_BIT);
Re: 2D HUD in 3D Program
Reply #2 - Apr 22nd, 2008, 3:31pm
 
Hi,

Hope you don't think i'm hijacking your thread (it is the same problem)...

But how do you get this to work if you are using additive blending (as described by Flight404 here: http://www.processingblogs.org/2007/03/31/mini-tutorial-additive-blending/ ). Because it uses gl.glDisable(GL.GL_DEPTH_TEST); to get rid of an overlapping problem with textures.

I've tried loads of things, including the in-built Processing hint/unhint to disable depth testing, gl stuff etc. Any ideas?
Re: 2D HUD in 3D Program
Reply #3 - Apr 22nd, 2008, 5:52pm
 
Hey John, Thanks!
Works like a charm, thank you : )
Page Index Toggle Pages: 1