haris
haris

Reputation: 65

Java3D object exported as BufferedImage

-- may be this query has been on circuit before but I can't find an answer anywhere. --

I have designed a Java3D object which is composed of different shapes, with different colors and lightning effects. Now I like to export this object as BufferedImage. Is there any way to do it. please share your thoughts.

thanks

Upvotes: 1

Views: 884

Answers (1)

JohnnyO
JohnnyO

Reputation: 3058

If I understand your question, it sounds like you want to take a screenshot of the current 3D scene? If so, you might want to look at the java.awt.Robot class, something like the following:

        Robot robot = new Robot();
        // Capture the screen shot of the area of the screen defined by the rectangle
        BufferedImage bi=robot.createScreenCapture(new Rectangle(100,100));
        ImageIO.write(bi, "jpg", new File("C:/imageTest.jpg"));

source: http://www.java-tips.org/java-se-tips/java.awt/how-to-capture-screenshot.html

Upvotes: 1

Related Questions