Example usage for javax.media.j3d ImageComponent2D ImageComponent2D

List of usage examples for javax.media.j3d ImageComponent2D ImageComponent2D

Introduction

In this page you can find the example usage for javax.media.j3d ImageComponent2D ImageComponent2D.

Prototype

public ImageComponent2D(int format, int width, int height) 

Source Link

Document

Constructs a 2D image component object using the specified format, width, and height.

Usage

From source file:ReadRaster.java

public void init() {

    int width = 128;
    int height = 128;

    ImageComponent2D readImageComponent = new ImageComponent2D(ImageComponent.FORMAT_RGB, width, height);

    Raster readRaster = new Raster(new Point3f(0.0f, 0.0f, 0.0f), Raster.RASTER_COLOR, 0, 0, width, height,
            readImageComponent, null);//from  w w  w  .  ja v a2 s  .  c o  m

    setLayout(new BorderLayout());
    GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();

    Canvas3D c = new myCanvas3D(config, readRaster);
    add("Center", c);

    // Create a simple scene and attach it to the virtual universe
    BufferedImage bImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

    BranchGroup scene = createSceneGraph(bImage, readRaster);
    u = new SimpleUniverse(c);

    // This will move the ViewPlatform back a bit so the
    // objects in the scene can be viewed.
    u.getViewingPlatform().setNominalViewingTransform();

    u.addBranchGraph(scene);
}