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 & HelpSyntax Questions › selection menu in PApplet
Page Index Toggle Pages: 1
selection menu in PApplet (Read 1944 times)
selection menu in PApplet
Oct 12th, 2007, 7:20am
 
Is there any library that can create cool selection menus in full screen mode (in processing) like the following:

http://www.oniva.com/upload/1356/select2.jpg
http://www.oniva.com/upload/1356/select3.jpg

Any open source code (processing) example?
Re: selection menu in PApplet
Reply #1 - Oct 12th, 2007, 6:18pm
 
processing can do fullscreen and there are also some GUI libraries (but it can easily be done without them). now its your job to create something "cool" Wink

what will the interface be for?
Re: selection menu in PApplet
Reply #2 - Oct 12th, 2007, 9:44pm
 
I looked at the GUI library of processing but all of them are standard 2D GUI similar to what we see in a web page.

Is there any library / open source code reference, to create more 3D game type fancy GUI(selection menu) - 3D + transparency

similar to the following:
http://www.hardcorepawn.com/fog/ex3.html

http://img215.imageshack.us/my.php?image=m1vm2.jpg

http://img215.imageshack.us/my.php?image=m2zi2.jpg

http://img222.imageshack.us/my.php?image=m3hd2.jpg

http://img222.imageshack.us/my.php?image=m4jo4.jpg

http://img222.imageshack.us/my.php?image=m5dr3.jpg

my goal is to have some 3D object moving in background + some transparent (selection menu)


Re: selection menu in PApplet
Reply #3 - Oct 13th, 2007, 4:37am
 
an easy way would be to create the eyecandy in photoshop and use PImage and loadImage() to display them. transparency is supported.
for the 3d object, have a look at the 3D learning examples.
Re: selection menu in PApplet
Reply #4 - Oct 18th, 2007, 7:49pm
 
Is there any source code example to do that with keyboard events?
Re: selection menu in PApplet
Reply #5 - Oct 19th, 2007, 1:34am
 
something like this? i don't understand your question though Wink

Quote:


int nrOfButtons = 5;  // nr of buttons we want to draw
int selection = 0;    // nr of the currently selected button


// setting stuff up
void setup() {
 size(300,300);
 stroke(255);
}


void draw() {
 background(0);

 // draw a rect for every button
 for (int i=0; i<nrOfButtons; i++) {

   if (i==selection) {
     // this is the currently selected button, give it another look
     strokeWeight(3);
     fill(200);
   }
   else {
     // this is NOT a selected button
     strokeWeight(1);
     fill(100);
   }

   rect( 120, 20+i*30, 60,20);
 }
}


// if up key is pressed, next button above is selected
// if down key is presse, next button below is selected
void keyPressed() {
 if (keyCode == UP) {
   selection--;
   selection = max(selection, 0); // dont let the value go below 0
 }
 else if (keyCode == DOWN) {
   selection++;
   selection = min(selection, nrOfButtons-1); // dont let the value go beyond the nr of buttons
 }
}


Re: selection menu in PApplet
Reply #6 - Oct 19th, 2007, 6:23am
 
Thank you your help!

any way to have Eye Candy UI on top of 3D graphics like the following?

http://www.bit-101.com/p5/sketch_031110a/applet/

that is putting 2D transparent UI (PImage etc...) on top of 3D graphics.

Is it possible?
Re: selection menu in PApplet
Reply #7 - Oct 19th, 2007, 10:13am
 
Yes, you need to clear the z-buffer after drawig the 3D stuff, and then you can draw 2D stuff as if the 3D stuff was just a background image.

With P3D:
Code:
Arrays.fill(((PGraphics3D)g).zbuffer,Float.MAX_VALUE); 



Or with OpenGL:
Code:
//at top of file:
import javax.media.opengl.*;

//in your code:
GL gl=((PGraphicsOpenGL)g).beginGL();
gl.glClear(GL.GL_DEPTH_BUFFER_BIT);
((PGraphicsOpenGL)g).endGL();
Re: selection menu in PApplet
Reply #8 - Oct 24th, 2007, 2:39pm
 
this should no longer be necessary with the current release of processing. use hint(DISABLE_DEPTH_TEST) to shut off depth testing, which will allow you to draw 2D style on top of 3D objects. use unhint(DISABLE_DEPTH_TEST) to turn it back on when you're done.
Re: selection menu in PApplet
Reply #9 - Oct 24th, 2007, 2:44pm
 
fry wrote on Oct 24th, 2007, 2:39pm:
unhint(DISABLE_DEPTH_TEST)


that's terrible 8)

what's wrong with 'hint(ENABLE_DEPTH_TEST)'
Re: selection menu in PApplet
Reply #10 - Oct 24th, 2007, 3:21pm
 
double negatives in api are awesome.

most of the hints are not things that you'll be disabling, and this would double the number of constants. the hint is also designed to be ENABLE or DISABLE, relative to the default behavior, so we'd lose the sense of which end is up.

but.. it's a thought.
Re: selection menu in PApplet
Reply #11 - May 27th, 2008, 3:50pm
 
Has anyone got this straighten out?
I tried all the ways. It wirks fine in the above example code, but not when I do it in a larger 3D-scene.

No errors, just no 2D on topof the 3D viewport...

Anyone got any ideas?

All the best
/JohanW
Page Index Toggle Pages: 1