Sign in to follow this  
AbelCorver

[java] User Interface painted in 2D overlapping the 3d world

Recommended Posts

AbelCorver    112
Hello everyone! I'm creating a graphical user interface for a 3d game I'm developing. I want to draw the GUI translucent on the 3d world, but in 2D (not 3D). This means that the GUI is not part of the 3d world. Should I use the glasspane, jME? I created a panel/box (in the 3d world) right in front of the view and I try to render the content of a JPanel to a BufferedImage and than set that image as a texture for the box I created previously. This will be a problem for mouse events etc. There has to be an easier way!! Thanks in advance!

Share this post


Link to post
Share on other sites
Antheus    2409
Quote:
There has to be an easier way!!


Yes, by not involving Swing at all.

3D UIs are in general rendered fully using 3D API, events are handled manually, but monitoring the mouse cursor and clicks, something you need to do anyway.

Doesn't jME provide something like that already?

Share this post


Link to post
Share on other sites
jouley    805
Quote:
Original post by Antheus
Quote:
There has to be an easier way!!

Doesn't jME provide something like that already?

Without knowing the answer to that right offhand, it does have pretty simple support for an orthographic projection, which, OP, is the usual way of drawing something 2D on top of your "3D world." You'll have to determine how best to handle clicks and such, but use setOrtho to draw your GUI's elements at the end of each frame. Don't forget to unsetOrtho, too.

Share this post


Link to post
Share on other sites

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