Skip to main content

Draw 2D Bounding Box on Canvas3D

1 reply [Last post]
Joined: 2010-05-19


I'd like to draw a 2D bounding box around a 3D object. I use the postRender() method to draw 2D shapes on the canvas. Now I need to know how I can determine which pixels display the 3D object (to get the information about 2D position, width and height) in the VirtualUniverse so that I can draw a fitting 2D box around it on the Canvas.

Thanks in advance,

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-08-02

I suspect you will have to calculate it your self from GraphicsConfiguration.getBounds() (or something like it) and the relative positions of your 3D Object and the View.

The Robot.createScreenCapture() method is the only one that I am aware of that interrogates screen pixels, but it uses peer.getRGBPixels() which isn't available to the likes of us. You can see it in the source code.