Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6928389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:10:53+00:00 2026-05-27T11:10:53+00:00

I used the technique answered this question: Java3D: Painting 2D HUD over a Canvas3D

  • 0

I used the technique answered this question: Java3D: Painting 2D HUD over a Canvas3D

And my code is something like this:

...
    GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
    Canvas3D canvas3D = new Canvas3D(config){
        public void postRender()
        {
            this.getGraphics2D().setColor(Color.white);
            this.getGraphics2D().drawString("Heads Up Display (HUD) Works!",100,100);
            this.getGraphics2D().flush(false);
        }

    };
...

How could I later remove this 2D HUD or edit this 2D HUD?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:10:53+00:00Added an answer on May 27, 2026 at 11:10 am

    If the render renders each frame completely from scratch, you can add, for example, a static boolean in the same class with your postRender() method. Then inside the method use an if statment to check if the boolean if true, otherwise don’t do anything, if you then set the boolean to false via

    ClassName.boolean_name=false;
    

    The HUD should not show. As for changing it, that’s possible, and would really depend on what type of information you want to show. Here is an example I’d use for games, but it can fit several subjects.

    I would want to store FPS, x, y, and z positions If I was working on a game, so what I would do is create a variable inside the class for each attribute I needed to display, then something like this:

    Graphics2D G2D = this.getGraphics2D()
    G2D.setColor(Color.white);
    G2D.drawString("FPS: "+fps, 100, 100);
    G2D.drawString("X: "+x_pos, 100, 80);
    G2D.drawString("Y: "+y_pos, 100, 60);
    G2D.drawString("Z: "+z_pos, 100, 40);
    G2D.flush(false);
    

    Also if you notice I set G2D equal to this.getGraphics2D(), that way I didn’t need to call an external method each time I wanted to use the Graphics2D object, each time you call getGraphics2D() it has to go to that class, call that method, and return the value, as compared to just getting it once, and using it, faster type type, and in the long run creates faster speeds.

    What I would do after all this is I could just set each variable to the correct value, and it would display, that’s one way of updating it, you could do similar make a variable for each line, and go:

    line1="this is some text";
    list2="this is some more text";
    list3="etc...";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please explain the technique used in this code to test Object Equality and Identity.
Never used a cache like this before. The problem is that I want to
Primarily this seems to be a technique used by games, where they have all
I know it can be done in Java, as I have used this technique
This question is a slight extension of the one answered here . I am
Example page I'm working on I used technique mentioned on this page : Basically
What is a tool or technique that can be used to perform spell checks
I cannot find comparison of these parsing technique. Which one is most commonly used?
What is the most standard encryption technique used in sql server for asp.net c#
I was asked this question in a .net/C# interview: If we have two threads

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.