Example usage for javax.media.j3d View addCanvas3D

List of usage examples for javax.media.j3d View addCanvas3D

Introduction

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

Prototype

public void addCanvas3D(Canvas3D canvas3D) 

Source Link

Document

Adds the given Canvas3D at the end of the list.

Usage

From source file:SwingTest.java

/**
 * Create a Java 3D View and attach it to a ViewPlatform
 *///w  w w  .j  a v  a2  s .  c  o  m
protected View createView(ViewPlatform vp) {
    View view = new View();

    PhysicalBody pb = createPhysicalBody();
    PhysicalEnvironment pe = createPhysicalEnvironment();

    view.setPhysicalEnvironment(pe);
    view.setPhysicalBody(pb);

    if (vp != null)
        view.attachViewPlatform(vp);

    view.setBackClipDistance(getBackClipDistance());
    view.setFrontClipDistance(getFrontClipDistance());

    // create the visible canvas
    Canvas3D c3d = createCanvas3D(false);
    view.addCanvas3D(c3d);

    // create the off screen canvas
    view.addCanvas3D(createOffscreenCanvas3D());

    // add the visible canvas to a component
    addCanvas3D(c3d);

    return view;
}

From source file:MixedTest.java

protected View createView(ViewPlatform vp) {
    View view = new View();

    PhysicalBody pb = createPhysicalBody();
    PhysicalEnvironment pe = createPhysicalEnvironment();

    AudioDevice audioDevice = createAudioDevice(pe);

    if (audioDevice != null) {
        pe.setAudioDevice(audioDevice);/*from ww  w. ja v  a 2s. c  o  m*/
        audioDevice.initialize();
    }

    view.setPhysicalEnvironment(pe);
    view.setPhysicalBody(pb);

    if (vp != null)
        view.attachViewPlatform(vp);

    view.setBackClipDistance(getBackClipDistance());
    view.setFrontClipDistance(getFrontClipDistance());

    Canvas3D c3d = createCanvas3D();
    view.addCanvas3D(c3d);
    addCanvas3D(c3d);

    return view;
}