2D on top of 3D

edited September 2017 in Library Questions

This seems like an easy question to answer but I can not figure it out.

I am attempting to draw a 2D GUI on top of a 3D sketch. I am using PeasyCam in order to move around in 3d Space, so my position and angle where I am looking is changing all the time. I want to create a crosshair in the center of the screen, any help?

Tagged:

Answers

  • edited September 2017 Answer ✓

    at the very bottom of the peasycam webpage:

    // Utility methods to permit the use of a Heads-Up Display
    // Thanks, A.W. Martin
    camera.beginHUD();
    // now draw things that you want relative to the camera's position and orientation
    camera.endHUD(); // always!

  • Answer ✓

    PeasyCam has two simple instructions to do that

    void draw(){
      background(0);
      // 3D drawing stuff here
      pcam.beginHUD();
      // 2D stuff here
      pcam.endHUD();
    }
    

    where pcam is a PeasyCam object.

    If you are creating a desktop application, G4P provides a set of GUI controls that work with PeasyCam or any P3D application

  • edited September 2017 Answer ✓

    @Snoweyy -- if you are trying to create a layered display, rather than a simple HUD or a GUI, a third approach is to use PGraphics and build your 2D HUD and 3D world out of different graphics layers:

Sign In or Register to comment.