javax.media.j3d
Class GraphicsContext3D

java.lang.Object
  extended by javax.media.j3d.GraphicsContext3D

public class GraphicsContext3D
extends java.lang.Object

A GraphicsContext3D object is used for immediate mode rendering into a 3D canvas. It is created by, and associated with, a specific Canvas3D object. A GraphicsContext3D defines methods to set 3D graphics state and draw 3D geometric primitives. There are no public constructors of GraphicsContext3D. An application obtains a 3D graphics context object from the Canvas3D object that the application wishes to render into by using the getGraphicsContext3D method. A new graphics context is created if one does not already exist. A new GraphicsContext3D initializes its state variables to the following defaults:

Note that the drawing methods in this class are not necessarily executed immediately. They may be buffered up for future execution. Applications must call the flush(boolean) method to ensure that the rendering actually happens. The flush method is implicitly called in the following cases:

A single-buffered, pure-immediate mode application must explicitly call flush to ensure that the graphics will be rendered to the Canvas3D.

See Also:
Canvas3D.getGraphicsContext3D()

Field Summary
(package private) static int ADD_LIGHT
           
(package private) static int ADD_SOUND
           
(package private)  float alpha
          The cached TransparencyAttributes transparency value.
(package private)  Appearance appearance
           
(package private)  AuralAttributes auralAttributes
           
(package private)  Background background
           
(package private)  BackgroundRetained black
           
(package private)  float blue
           
private static int BUFFER_MODE
           
(package private)  boolean bufferOverride
           
(package private)  byte[] byteBuffer
           
(package private)  Canvas3D canvas3d
          Canvas3D in which this GraphicsContext3D will render.
(package private) static int CLEAR
           
private static java.lang.Integer[] commands
           
(package private)  Transform3D compTransform
           
(package private)  float dBlue
           
private  Appearance defaultAppearance
           
(package private)  AppearanceRetained defaultAppearanceRetained
           
(package private)  float dGreen
           
private  int dirtyMask
           
(package private) static int DISPOSE2D
           
(package private) static int DRAW
           
(package private) static int DRAWANDFLUSH2D
           
(package private)  Transform3D drawTransform
           
(package private)  float dRed
          Cached diffuse color value
(package private)  boolean enableLighting
          /** A boolean indicating whether or not lighting should be on.
(package private)  float[] floatBuffer
           
(package private) static int FLUSH
           
(package private) static int FLUSH2D
           
(package private)  Fog fog
           
(package private)  boolean frontBufferRendering
           
private  boolean gcReady
           
private  boolean geometryIsLocked
           
(package private)  float green
           
(package private)  HiResCoord hiRes
           
(package private)  Transform3D identityTransform
           
private  boolean ignoreVertexColors
           
(package private) static int INSERT_LIGHT
           
(package private) static int INSERT_SOUND
           
(package private)  int[] intBuffer
           
private  int lastActiveTexUnitIndex
           
(package private)  LightRetained[] lightlist
           
(package private)  java.util.Vector lights
           
(package private)  boolean lightsChanged
           
(package private)  boolean lineAA
           
(package private)  LightSet ls
           
(package private)  ModelClip modelClip
           
(package private)  Transform3D modelClipTransform
           
(package private)  Transform3D modelTransform
           
(package private) static int MULTIPLY_MODEL_TRANSFORM
           
(package private) static int NCOMMANDS
           
(package private)  Transform3D normalTransform
           
(package private)  boolean normalTransformNeedToUpdate
           
private  int numActiveTexUnit
           
(package private)  int numLights
           
(package private)  boolean pointAA
           
(package private)  int polygonMode
          Cached values for polygonMode, line antialiasing, and point antialiasing
(package private) static int READ_RASTER
           
private  boolean readRasterReady
           
(package private)  float red
          The cached ColoringAttributes color value.
(package private) static int REMOVE_LIGHT
           
(package private) static int REMOVE_SOUND
           
(package private)  Color3f sceneAmbient
           
(package private) static int SET_APPEARANCE
           
(package private) static int SET_AURAL_ATTRIBUTES
           
(package private) static int SET_BACKGROUND
           
(package private) static int SET_BUFFER_OVERRIDE
           
(package private) static int SET_FOG
           
(package private) static int SET_FRONT_BUFFER_RENDERING
           
(package private) static int SET_HI_RES
           
(package private) static int SET_LIGHT
           
(package private) static int SET_MODEL_TRANSFORM
           
(package private) static int SET_MODELCLIP
           
(package private) static int SET_SOUND
           
(package private) static int SET_STEREO_MODE
           
(package private)  java.util.Vector sounds
           
(package private)  boolean soundsChanged
           
static int STEREO_BOTH
          Specifies that rendering is done to both eyes.
static int STEREO_LEFT
          Specifies that rendering is done to the left eye.
static int STEREO_RIGHT
          Specifies that rendering is done to the right eye.
(package private)  int stereoMode
           
private static java.lang.Integer[] stereoModes
           
(package private) static int SWAP
           
private  Appearance uAppearance
           
private  AuralAttributes uAuralAttributes
           
private  Background uBackground
           
private  boolean uBufferOverride
           
private  Fog uFog
           
private  boolean uFrontBufferRendering
           
private  HiResCoord uHiRes
           
private  java.util.Vector uLights
           
private  ModelClip uModelClip
           
private  java.util.Vector uSounds
           
private  int uStereoMode
           
(package private)  boolean visible
          The cached visible flag for geometry.
(package private)  Transform3D vpcToEc
           
private  int waiting
           
 
Constructor Summary
GraphicsContext3D(Canvas3D canvas3d)
          Constructs and creates a GraphicsContext3D object with default values.
 
Method Summary
 void addLight(Light light)
          Appends the specified light to this graphics context's list of lights.
 void addSound(Sound sound)
          Appends the specified sound to this graphics context's list of sounds.
 void clear()
          Clear the Canvas3D to the color or image specified by the current background node.
private  void computeCompositeTransform()
           
(package private)  void doAddLight(Light light)
           
(package private)  void doAddSound(Sound sound)
           
(package private)  void doClear()
           
(package private)  void doDraw(Geometry geometry)
           
(package private)  void doFlush(boolean wait)
           
(package private)  void doInsertLight(Light light, int index)
           
(package private)  void doInsertSound(Sound sound, int index)
           
(package private)  void doMultiplyModelTransform(Transform3D t)
           
(package private)  void doReadRaster(Raster raster)
           
(package private)  void doRemoveLight(int index)
           
(package private)  void doRemoveSound(int index)
           
(package private)  void doSetAppearance(Appearance appearance)
           
(package private)  void doSetAuralAttributes(AuralAttributes attributes)
           
(package private)  void doSetBackground(Background background)
           
(package private)  void doSetBufferOverride(boolean bufferOverride)
           
(package private)  void doSetFog(Fog fog)
           
(package private)  void doSetFrontBufferRendering(boolean frontBufferRendering)
           
(package private)  void doSetHiRes(HiResCoord hiRes)
           
(package private)  void doSetLight(Light light, int index)
           
(package private)  void doSetModelClip(ModelClip modelClip)
           
(package private)  void doSetModelTransform(Transform3D t)
           
(package private)  void doSetSound(Sound sound, int index)
           
(package private)  void doSetStereoMode(int stereoMode)
           
 void draw(Geometry geometry)
          Draw the specified Geometry component object.
 void draw(Shape3D shape)
          Draw the specified Shape3D leaf node object.
 void flush(boolean wait)
          Flushes all previously executed rendering operations to the drawing buffer for this 3D graphics context.
 java.util.Enumeration getAllLights()
          Retrieves the enumeration object of all the lights.
 java.util.Enumeration getAllSounds()
          Retrieves the enumeration object of all the sounds.
 Appearance getAppearance()
          Retrieves the current Appearance component object.
 AuralAttributes getAuralAttributes()
          Retrieves the current AuralAttributes component object.
 Background getBackground()
          Retrieves the current Background leaf node object.
 boolean getBufferOverride()
          Returns the current buffer override flag.
 Canvas3D getCanvas3D()
          Gets the Canvas3D that created this GraphicsContext3D.
 Fog getFog()
          Retrieves the current Fog leaf node object.
 boolean getFrontBufferRendering()
          Returns the current front buffer rendering flag.
 void getHiRes(HiResCoord hiRes)
          Retrieves the current HiRes coordinate of this context.
(package private) static java.lang.Integer getImmCommand(int command)
           
 Light getLight(int index)
          Retrieves the index selected light.
 ModelClip getModelClip()
          Retrieves the current ModelClip leaf node object.
 void getModelTransform(Transform3D t)
          Retrieves the current model transform.
private  Transform3D getNormalTransform()
           
 Sound getSound(int index)
          Retrieves the index selected sound.
(package private)  SoundScheduler getSoundScheduler()
           
 int getStereoMode()
          Returns the current stereo mode.
(package private)  void initializeState()
           
 void insertLight(Light light, int index)
          Inserts the specified light at the specified index location.
 void insertSound(Sound sound, int index)
          Inserts the specified sound at the specified index location.
 boolean isSoundPlaying(int index)
          Retrieves the sound playing flag.
 void multiplyModelTransform(Transform3D t)
          Multiplies the current model transform by the specified transform and stores the result back into the current transform.
 int numLights()
          Retrieves the current number of lights in this graphics context.
 int numSounds()
          Retrieves the current number of sounds in this graphics context.
 void readRaster(Raster raster)
          Read an image from the frame buffer and copy it into the ImageComponent and/or DepthComponent objects referenced by the specified Raster object.
 void removeLight(int index)
          Removes the light at the specified index location.
 void removeSound(int index)
          Removes the sound at the specified index location.
(package private)  void resetAppearance()
           
(package private)  void runMonitor(int action)
           
(package private)  void sendRenderMessage(boolean renderRun, int command, java.lang.Object arg1, java.lang.Object arg2)
           
(package private)  void sendSoundMessage(int command, java.lang.Object arg1, java.lang.Object arg2)
           
 void setAppearance(Appearance appearance)
          Sets the current Appearance object to the specified Appearance component object.
 void setAuralAttributes(AuralAttributes attributes)
          Sets the current AuralAttributes object to the specified AuralAttributes component object.
 void setBackground(Background background)
          Sets the current Background to the specified Background leaf node object.
 void setBufferOverride(boolean bufferOverride)
          Sets a flag that specifies whether the double buffering and stereo mode from the Canvas3D are overridden.
 void setFog(Fog fog)
          Sets the current Fog to the specified Fog leaf node object.
 void setFrontBufferRendering(boolean frontBufferRendering)
          Sets a flag that enables or disables immediate mode rendering into the front buffer of a double buffered Canvas3D.
 void setHiRes(HiResCoord hiRes)
          Sets the HiRes coordinate of this context to the location specified by the HiRes argument.
 void setHiRes(int[] x, int[] y, int[] z)
          Sets the HiRes coordinate of this context to the location specified by the parameters provided.
 void setLight(Light light, int index)
          Replaces the specified light with the light provided.
 void setModelClip(ModelClip modelClip)
          Sets the current ModelClip leaf node to the specified object.
 void setModelTransform(Transform3D t)
          Sets the current model transform to a copy of the specified transform.
 void setSound(Sound sound, int index)
          Replaces the specified sound with the sound provided.
 void setStereoMode(int stereoMode)
          Sets the stereo mode for immediate mode rendering.
(package private)  void updateFogState(FogRetained fogRet)
           
(package private)  void updateLightAndFog()
           
(package private)  void updateLightState(LightRetained light)
           
(package private)  void updateModelClip(Transform3D vworldToVpc)
           
(package private)  void updateSoundState(SoundRetained sound)
           
(package private)  boolean updateState(RenderBin rb, int geometryType)
           
private  void updateViewCache(RenderBin rb)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STEREO_LEFT

public static final int STEREO_LEFT
Specifies that rendering is done to the left eye.

Since:
Java 3D 1.2
See Also:
setStereoMode(int), Constant Field Values

STEREO_RIGHT

public static final int STEREO_RIGHT
Specifies that rendering is done to the right eye.

Since:
Java 3D 1.2
See Also:
setStereoMode(int), Constant Field Values

STEREO_BOTH

public static final int STEREO_BOTH
Specifies that rendering is done to both eyes. This is the default.

Since:
Java 3D 1.2
See Also:
setStereoMode(int), Constant Field Values

canvas3d

Canvas3D canvas3d
Canvas3D in which this GraphicsContext3D will render.


uBackground

private Background uBackground

uFog

private Fog uFog

uAppearance

private Appearance uAppearance

uLights

private java.util.Vector uLights

uHiRes

private HiResCoord uHiRes

uSounds

private java.util.Vector uSounds

uAuralAttributes

private AuralAttributes uAuralAttributes

uBufferOverride

private boolean uBufferOverride

uFrontBufferRendering

private boolean uFrontBufferRendering

uStereoMode

private int uStereoMode

uModelClip

private ModelClip uModelClip

background

Background background

black

BackgroundRetained black

fog

Fog fog

modelClip

ModelClip modelClip

appearance

Appearance appearance

defaultAppearanceRetained

AppearanceRetained defaultAppearanceRetained

lights

java.util.Vector lights

hiRes

HiResCoord hiRes

modelTransform

Transform3D modelTransform

identityTransform

Transform3D identityTransform

modelClipTransform

Transform3D modelClipTransform

normalTransform

Transform3D normalTransform

normalTransformNeedToUpdate

boolean normalTransformNeedToUpdate

sounds

java.util.Vector sounds

auralAttributes

AuralAttributes auralAttributes

ls

LightSet ls

lightlist

LightRetained[] lightlist

sceneAmbient

Color3f sceneAmbient

numLights

int numLights

compTransform

Transform3D compTransform

drawTransform

Transform3D drawTransform

vpcToEc

Transform3D vpcToEc

lightsChanged

boolean lightsChanged

soundsChanged

boolean soundsChanged

bufferOverride

boolean bufferOverride

frontBufferRendering

boolean frontBufferRendering

stereoMode

int stereoMode

byteBuffer

byte[] byteBuffer

floatBuffer

float[] floatBuffer

intBuffer

int[] intBuffer

red

float red
The cached ColoringAttributes color value. It is 1.0, 1.0, 1.0 if there is no ColoringAttributes.


green

float green

blue

float blue

dRed

float dRed
Cached diffuse color value


dGreen

float dGreen

dBlue

float dBlue

alpha

float alpha
The cached TransparencyAttributes transparency value. It is 0.0 if there is no TransparencyAttributes.


visible

boolean visible
The cached visible flag for geometry.


polygonMode

int polygonMode
Cached values for polygonMode, line antialiasing, and point antialiasing


lineAA

boolean lineAA

pointAA

boolean pointAA

enableLighting

boolean enableLighting
/** A boolean indicating whether or not lighting should be on.


defaultAppearance

private Appearance defaultAppearance

geometryIsLocked

private boolean geometryIsLocked

ignoreVertexColors

private boolean ignoreVertexColors

CLEAR

static final int CLEAR
See Also:
Constant Field Values

DRAW

static final int DRAW
See Also:
Constant Field Values

SWAP

static final int SWAP
See Also:
Constant Field Values

READ_RASTER

static final int READ_RASTER
See Also:
Constant Field Values

SET_APPEARANCE

static final int SET_APPEARANCE
See Also:
Constant Field Values

SET_BACKGROUND

static final int SET_BACKGROUND
See Also:
Constant Field Values

SET_FOG

static final int SET_FOG
See Also:
Constant Field Values

SET_LIGHT

static final int SET_LIGHT
See Also:
Constant Field Values

INSERT_LIGHT

static final int INSERT_LIGHT
See Also:
Constant Field Values

REMOVE_LIGHT

static final int REMOVE_LIGHT
See Also:
Constant Field Values

ADD_LIGHT

static final int ADD_LIGHT
See Also:
Constant Field Values

SET_HI_RES

static final int SET_HI_RES
See Also:
Constant Field Values

SET_MODEL_TRANSFORM

static final int SET_MODEL_TRANSFORM
See Also:
Constant Field Values

MULTIPLY_MODEL_TRANSFORM

static final int MULTIPLY_MODEL_TRANSFORM
See Also:
Constant Field Values

SET_SOUND

static final int SET_SOUND
See Also:
Constant Field Values

INSERT_SOUND

static final int INSERT_SOUND
See Also:
Constant Field Values

REMOVE_SOUND

static final int REMOVE_SOUND
See Also:
Constant Field Values

ADD_SOUND

static final int ADD_SOUND
See Also:
Constant Field Values

SET_AURAL_ATTRIBUTES

static final int SET_AURAL_ATTRIBUTES
See Also:
Constant Field Values

SET_BUFFER_OVERRIDE

static final int SET_BUFFER_OVERRIDE
See Also:
Constant Field Values

SET_FRONT_BUFFER_RENDERING

static final int SET_FRONT_BUFFER_RENDERING
See Also:
Constant Field Values

SET_STEREO_MODE

static final int SET_STEREO_MODE
See Also:
Constant Field Values

FLUSH

static final int FLUSH
See Also:
Constant Field Values

FLUSH2D

static final int FLUSH2D
See Also:
Constant Field Values

DRAWANDFLUSH2D

static final int DRAWANDFLUSH2D
See Also:
Constant Field Values

SET_MODELCLIP

static final int SET_MODELCLIP
See Also:
Constant Field Values

DISPOSE2D

static final int DISPOSE2D
See Also:
Constant Field Values

NCOMMANDS

static final int NCOMMANDS
See Also:
Constant Field Values

commands

private static java.lang.Integer[] commands

stereoModes

private static java.lang.Integer[] stereoModes

BUFFER_MODE

private static final int BUFFER_MODE
See Also:
Constant Field Values

dirtyMask

private int dirtyMask

numActiveTexUnit

private int numActiveTexUnit

lastActiveTexUnitIndex

private int lastActiveTexUnitIndex

readRasterReady

private volatile boolean readRasterReady

gcReady

private boolean gcReady

waiting

private int waiting
Constructor Detail

GraphicsContext3D

GraphicsContext3D(Canvas3D canvas3d)
Constructs and creates a GraphicsContext3D object with default values. Users do not call this directly, rather they get a graphics context from a Canvas3D.

Method Detail

getCanvas3D

public Canvas3D getCanvas3D()
Gets the Canvas3D that created this GraphicsContext3D.

Returns:
the Canvas3D that created this GraphicsContext3D

setAppearance

public void setAppearance(Appearance appearance)
Sets the current Appearance object to the specified Appearance component object. The graphics context stores a reference to the specified Appearance object. This means that the application may modify individual appearance attributes by using the appropriate methods on the Appearance object. If the Appearance object is null, default values will be used for all appearance attributes - it is as if an Appearance node were created using the default constructor.

Parameters:
appearance - the new Appearance object
Throws:
IllegalSharingException - if the specified appearance refers to an ImageComponent2D that is being used by a Canvas3D as an off-screen buffer.

doSetAppearance

void doSetAppearance(Appearance appearance)

getAppearance

public Appearance getAppearance()
Retrieves the current Appearance component object.

Returns:
the current Appearance object

setBackground

public void setBackground(Background background)
Sets the current Background to the specified Background leaf node object. The graphics context stores a reference to the specified Background node. This means that the application may modify the background color or image by using the appropriate methods on the Background node. The Background node must not be part of a live scene graph, nor may it subsequently be made part of a live scene graph-an IllegalSharingException is thrown in such cases. If the Background object is null, the default background color of black (0,0,0) is used to clear the canvas prior to rendering a new frame. The Background node's application region is ignored for immediate-mode rendering.

Parameters:
background - the new Background object
Throws:
IllegalSharingException - if the Background node is part of or is subsequently made part of a live scene graph.
IllegalSharingException - if the specified background node refers to an ImageComponent2D that is being used by a Canvas3D as an off-screen buffer.

doSetBackground

void doSetBackground(Background background)

getBackground

public Background getBackground()
Retrieves the current Background leaf node object.

Returns:
the current Background object

setFog

public void setFog(Fog fog)
Sets the current Fog to the specified Fog leaf node object. The graphics context stores a reference to the specified Fog node. This means that the application may modify the fog attributes using the appropriate methods on the Fog node object. The Fog node must not be part of a live scene graph, nor may it subsequently be made part of a live scene graph-an IllegalSharingException is thrown in such cases. If the Fog object is null, fog is disabled. Both the region of influence and the hierarchical scope of the Fog node are ignored for immediate-mode rendering.

Parameters:
fog - the new Fog object
Throws:
IllegalSharingException - if the Fog node is part of or is subsequently made part of a live scene graph.

doSetFog

void doSetFog(Fog fog)

getFog

public Fog getFog()
Retrieves the current Fog leaf node object.

Returns:
the current Fog object

setModelClip

public void setModelClip(ModelClip modelClip)
Sets the current ModelClip leaf node to the specified object. The graphics context stores a reference to the specified ModelClip node. This means that the application may modify the model clipping attributes using the appropriate methods on the ModelClip node object. The ModelClip node must not be part of a live scene graph, nor may it subsequently be made part of a live scene graph-an IllegalSharingException is thrown in such cases. If the ModelClip object is null, model clipping is disabled. Both the region of influence and the hierarchical scope of the ModelClip node are ignored for immediate-mode rendering.

Parameters:
modelClip - the new ModelClip node
Throws:
IllegalSharingException - if the ModelClip node is part of or is subsequently made part of a live scene graph.
Since:
Java 3D 1.2

doSetModelClip

void doSetModelClip(ModelClip modelClip)

getModelClip

public ModelClip getModelClip()
Retrieves the current ModelClip leaf node object.

Returns:
the current ModelClip object
Since:
Java 3D 1.2

setLight

public void setLight(Light light,
                     int index)
Replaces the specified light with the light provided. The graphics context stores a reference to each light object in the list of lights. This means that the application may modify the light attributes for any of the lights using the appropriate methods on that Light node object. None of the Light nodes in the list of lights may be part of a live scene graph, nor may they subsequently be made part of a live scene graph - an IllegalSharingException is thrown in such cases.

Parameters:
light - the new light
index - which light to replace
Throws:
IllegalSharingException - if the Light node is part of or is subsequently made part of a live scene graph.
java.lang.NullPointerException - if the Light object is null.

doSetLight

void doSetLight(Light light,
                int index)

insertLight

public void insertLight(Light light,
                        int index)
Inserts the specified light at the specified index location.

Parameters:
light - the new light
index - at which location to insert
Throws:
IllegalSharingException - if the Light node is part of or is subsequently made part of a live scene graph.
java.lang.NullPointerException - if the Light object is null.

doInsertLight

void doInsertLight(Light light,
                   int index)

removeLight

public void removeLight(int index)
Removes the light at the specified index location.

Parameters:
index - which light to remove

doRemoveLight

void doRemoveLight(int index)

getLight

public Light getLight(int index)
Retrieves the index selected light.

Parameters:
index - which light to return
Returns:
the light at location index

getAllLights

public java.util.Enumeration getAllLights()
Retrieves the enumeration object of all the lights.

Returns:
the enumeration object of all the lights

addLight

public void addLight(Light light)
Appends the specified light to this graphics context's list of lights. Adding a null Light object to the list will result in a NullPointerException. Both the region of influence and the hierarchical scope of all lights in the list are ignored for immediate-mode rendering.

Parameters:
light - the light to add
Throws:
IllegalSharingException - if the Light node is part of or is subsequently made part of a live scene graph.
java.lang.NullPointerException - if the Light object is null.

doAddLight

void doAddLight(Light light)

numLights

public int numLights()
Retrieves the current number of lights in this graphics context.

Returns:
the current number of lights

getNormalTransform

private Transform3D getNormalTransform()

updateFogState

void updateFogState(FogRetained fogRet)

updateLightState

void updateLightState(LightRetained light)

setHiRes

public void setHiRes(int[] x,
                     int[] y,
                     int[] z)
Sets the HiRes coordinate of this context to the location specified by the parameters provided. The parameters x, y, and z are arrays of eight 32-bit integers that specify the high-resolution coordinates point.

Parameters:
x - an eight element array specifying the x position
y - an eight element array specifying the y position
z - an eight element array specifying the z position
See Also:
HiResCoord

setHiRes

public void setHiRes(HiResCoord hiRes)
Sets the HiRes coordinate of this context to the location specified by the HiRes argument.

Parameters:
hiRes - the HiRes coordinate specifying the a new location

doSetHiRes

void doSetHiRes(HiResCoord hiRes)

getHiRes

public void getHiRes(HiResCoord hiRes)
Retrieves the current HiRes coordinate of this context.

Parameters:
hiRes - a HiResCoord object that will receive the HiRes coordinate of this context

setModelTransform

public void setModelTransform(Transform3D t)
Sets the current model transform to a copy of the specified transform. A BadTransformException is thrown if an attempt is made to specify an illegal Transform3D.

Parameters:
t - the new model transform
Throws:
BadTransformException - if the transform is not affine.

doSetModelTransform

void doSetModelTransform(Transform3D t)

multiplyModelTransform

public void multiplyModelTransform(Transform3D t)
Multiplies the current model transform by the specified transform and stores the result back into the current transform. The specified transformation must be affine.

Parameters:
t - the model transform to be concatenated with the current model transform
Throws:
BadTransformException - if the transform is not affine.

doMultiplyModelTransform

void doMultiplyModelTransform(Transform3D t)

getModelTransform

public void getModelTransform(Transform3D t)
Retrieves the current model transform.

Parameters:
t - the model transform that will receive the current model transform

setSound

public void setSound(Sound sound,
                     int index)
Replaces the specified sound with the sound provided. The graphics context stores a reference to each sound object in the list of sounds. This means that the application may modify the sound attributes for any of the sounds by using the appropriate methods on that Sound node object.

Parameters:
sound - the new sound
index - which sound to replace
Throws:
IllegalSharingException - if the Sound node is part of or is subsequently made part of a live scene graph.
java.lang.NullPointerException - if the Sound object is null.

doSetSound

void doSetSound(Sound sound,
                int index)

insertSound

public void insertSound(Sound sound,
                        int index)
Inserts the specified sound at the specified index location. Inserting a sound to the list of sounds implicitly starts the sound playing. Once a sound is finished playing, it can be restarted by setting the sound's enable flag to true. The scheduling region of all sounds in the list is ignored for immediate-mode rendering.

Parameters:
sound - the new sound
index - at which location to insert
Throws:
IllegalSharingException - if the Sound node is part or is subsequently made part of a live scene graph.
java.lang.NullPointerException - if the Sound object is null.

doInsertSound

void doInsertSound(Sound sound,
                   int index)

removeSound

public void removeSound(int index)
Removes the sound at the specified index location.

Parameters:
index - which sound to remove

doRemoveSound

void doRemoveSound(int index)

getSound

public Sound getSound(int index)
Retrieves the index selected sound.

Parameters:
index - which sound to return
Returns:
the sound at location index

getAllSounds

public java.util.Enumeration getAllSounds()
Retrieves the enumeration object of all the sounds.

Returns:
the enumeration object of all the sounds

addSound

public void addSound(Sound sound)
Appends the specified sound to this graphics context's list of sounds. Adding a sound to the list of sounds implicitly starts the sound playing. Once a sound is finished playing, it can be restarted by setting the sound's enable flag to true. The scheduling region of all sounds in the list is ignored for immediate-mode rendering.

Parameters:
sound - the sound to add
Throws:
IllegalSharingException - if the Sound node is part of or is subsequently made part of a live scene graph.
java.lang.NullPointerException - if the Sound object is null.

doAddSound

void doAddSound(Sound sound)

numSounds

public int numSounds()
Retrieves the current number of sounds in this graphics context.

Returns:
the current number of sounds

getSoundScheduler

SoundScheduler getSoundScheduler()

updateSoundState

void updateSoundState(SoundRetained sound)

isSoundPlaying

public boolean isSoundPlaying(int index)
Retrieves the sound playing flag.

Parameters:
index - which sound
Returns:
flag denoting if sound is currently playing

setAuralAttributes

public void setAuralAttributes(AuralAttributes attributes)
Sets the current AuralAttributes object to the specified AuralAttributes component object. This means that the application may modify individual audio attributes by using the appropriate methods in the Aural-Attributes object.

Parameters:
attributes - the new AuralAttributes object

doSetAuralAttributes

void doSetAuralAttributes(AuralAttributes attributes)

getAuralAttributes

public AuralAttributes getAuralAttributes()
Retrieves the current AuralAttributes component object.

Returns:
the current AuralAttributes object

setBufferOverride

public void setBufferOverride(boolean bufferOverride)
Sets a flag that specifies whether the double buffering and stereo mode from the Canvas3D are overridden. When set to true, this attribute enables the frontBufferRendering and stereoMode attributes.

Parameters:
bufferOverride - the new buffer override flag
Since:
Java 3D 1.2
See Also:
setFrontBufferRendering(boolean), setStereoMode(int)

doSetBufferOverride

void doSetBufferOverride(boolean bufferOverride)

getBufferOverride

public boolean getBufferOverride()
Returns the current buffer override flag.

Returns:
true if buffer override is enabled; otherwise, false is returned
Since:
Java 3D 1.2

setFrontBufferRendering

public void setFrontBufferRendering(boolean frontBufferRendering)
Sets a flag that enables or disables immediate mode rendering into the front buffer of a double buffered Canvas3D. This attribute is only used when the bufferOverride flag is enabled.

Note that this attribute has no effect if double buffering is disabled or is not available on the Canvas3D.

Parameters:
frontBufferRendering - the new front buffer rendering flag
Since:
Java 3D 1.2
See Also:
setBufferOverride(boolean)

doSetFrontBufferRendering

void doSetFrontBufferRendering(boolean frontBufferRendering)

getFrontBufferRendering

public boolean getFrontBufferRendering()
Returns the current front buffer rendering flag.

Returns:
true if front buffer rendering is enabled; otherwise, false is returned
Since:
Java 3D 1.2

setStereoMode

public void setStereoMode(int stereoMode)
Sets the stereo mode for immediate mode rendering. The parameter specifies which stereo buffer or buffers is rendered into. This attribute is only used when the bufferOverride flag is enabled.

Note that this attribute has no effect if stereo is disabled or is not available on the Canvas3D.

Parameters:
stereoMode - the new stereo mode
Since:
Java 3D 1.2
See Also:
setBufferOverride(boolean)

doSetStereoMode

void doSetStereoMode(int stereoMode)

getStereoMode

public int getStereoMode()
Returns the current stereo mode.

Returns:
the stereo mode, one of STEREO_LEFT, STEREO_RIGHT, or STEREO_BOTH.
Since:
Java 3D 1.2

clear

public void clear()
Clear the Canvas3D to the color or image specified by the current background node.


doClear

void doClear()

computeCompositeTransform

private void computeCompositeTransform()

updateViewCache

private void updateViewCache(RenderBin rb)

doDraw

void doDraw(Geometry geometry)

draw

public void draw(Geometry geometry)
Draw the specified Geometry component object.

Parameters:
geometry - the Geometry object to draw.
Throws:
IllegalSharingException - if the specified geometry is a Raster that refers to an ImageComponent2D that is being used by a Canvas3D as an off-screen buffer.

draw

public void draw(Shape3D shape)
Draw the specified Shape3D leaf node object. This is a convenience method that is identical to calling the setAppearance(Appearance) and draw(Geometry) methods passing the appearance and geometry component objects of the specified shape node as arguments.

Parameters:
shape - the Shape3D node containing the Appearance component object to set and Geometry component object to draw
Throws:
IllegalSharingException - if the Shape3D node is part of or is subsequently made part of a live scene graph.
IllegalSharingException - if the Shape3D node's Appearance refers to an ImageComponent2D that is being used by a Canvas3D as an off-screen buffer.

readRaster

public void readRaster(Raster raster)
Read an image from the frame buffer and copy it into the ImageComponent and/or DepthComponent objects referenced by the specified Raster object. All parameters of the Raster object and the component ImageComponent and/or DepthComponentImage objects must be set to the desired values prior to calling this method. These values determine the location, size, and format of the pixel data that is read. This method calls flush(true) prior to reading the frame buffer.

Parameters:
raster - the Raster object used to read the contents of the frame buffer
Throws:
java.lang.IllegalArgumentException - if the image class of the specified Raster's ImageComponent2D is not ImageClass.BUFFERED_IMAGE.
java.lang.IllegalArgumentException - if the specified Raster's ImageComponent2D is in by-reference mode and its RenderedImage is null.
java.lang.IllegalArgumentException - if the the Raster's ImageComponent2D format is not a 3-component format (e.g., FORMAT_RGB) or a 4-component format (e.g., FORMAT_RGBA).
IllegalSharingException - if the Raster object is part of a live scene graph, or if the Raster's ImageComponent2D is part of a live scene graph.
IllegalSharingException - if the Raster's ImageComponent2D is being used by an immediate mode context, or by a Canvas3D as an off-screen buffer.
See Also:
flush(boolean), ImageComponent, DepthComponent

doReadRaster

void doReadRaster(Raster raster)

flush

public void flush(boolean wait)
Flushes all previously executed rendering operations to the drawing buffer for this 3D graphics context.

Parameters:
wait - flag indicating whether or not to wait for the rendering to be complete before returning from this call.
Since:
Java 3D 1.2

doFlush

void doFlush(boolean wait)

updateLightAndFog

void updateLightAndFog()

updateModelClip

void updateModelClip(Transform3D vworldToVpc)

updateState

boolean updateState(RenderBin rb,
                    int geometryType)

initializeState

void initializeState()

resetAppearance

void resetAppearance()

sendRenderMessage

void sendRenderMessage(boolean renderRun,
                       int command,
                       java.lang.Object arg1,
                       java.lang.Object arg2)

sendSoundMessage

void sendSoundMessage(int command,
                      java.lang.Object arg1,
                      java.lang.Object arg2)

getImmCommand

static java.lang.Integer getImmCommand(int command)

runMonitor

void runMonitor(int action)


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.