Package javax.media.j3d
Class GraphicsConfigTemplate3D
java.lang.Object
java.awt.GraphicsConfigTemplate
javax.media.j3d.GraphicsConfigTemplate3D
- All Implemented Interfaces:
Serializable
This class is used to obtain a valid GraphicsConfiguration that can be used by Java 3D.
A user instantiates one of these objects and then sets all
non-default attributes as desired. The getBestConfiguration()
method in the GraphicsDevice class is then called with this
GraphicsConfigTemplate and the "best" GraphicsConfiguration is returned. The "best"
GraphicsConfiguration means that this GraphicsConfiguration is supported and it
meets or exceeds what was requested in the GraphicsConfigTemplate.
Null is returned if no such "best" GraphicsConfiguration is found.
- See Also:
-
Field Summary
Fields inherited from class java.awt.GraphicsConfigTemplate
PREFERRED, REQUIRED, UNNECESSARY -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a GraphicsConfigTemplate3D object with default parameters. -
Method Summary
Modifier and TypeMethodDescriptionImplement the abstract function of getBestConfiguration() in GraphicsConfigTemplate.intRetrieves the number of blue bits requested by this template.intRetrieves the size of the depth buffer.intRetrieves the double buffering value.intRetrieves the number of green bits requested by this template.intRetrieves the number of red bits requested by this template.intRetrieves the scene antialiasing value.intRetrieves the size of the stencil buffer.intRetrieves the stereo value.booleanReturns a boolean indicating whether or not the given GraphicsConfiguration can be used to create a drawing surface that can be rendered to.voidsetBlueSize(int value) Sets the number of blue bits required.voidsetDepthSize(int value) Sets the depth buffer size requirement.voidsetDoubleBuffer(int value) Sets the double buffering requirement.voidsetGreenSize(int value) Sets the number of green bits required.voidsetRedSize(int value) Sets the number of red bits required.voidsetSceneAntialiasing(int value) Sets the scene antialiasing requirement.voidsetStencilSize(int value) Sets the stencil buffer size requirement.voidsetStereo(int value) Sets the stereo requirement.toString()Returns a string representation of this object.
-
Constructor Details
-
GraphicsConfigTemplate3D
public GraphicsConfigTemplate3D()Constructs a GraphicsConfigTemplate3D object with default parameters. The default values are as follows:-
depthSize : 16
doubleBuffer : REQUIRED
sceneAntialiasing : UNNECESSARY
stereo : UNNECESSARY
redSize : 2
greenSize : 2
blueSize : 2
stencilSize : 0
-
-
Method Details
-
setDoubleBuffer
public void setDoubleBuffer(int value) Sets the double buffering requirement. It should be GraphicsConfigTemplate.REQUIRED, GraphicsConfigTemplate.PREFERRED, or GraphicsConfigTemplate.UNNECESSARY. If an invalid value is passed in, it is ignored. If the value of double buffering is GraphicsConfigTemplate.REQUIRED, and no GraphicsConfiguration is found that meets this requirement, null will be returned in getBestConfiguration().- Parameters:
value- the value to set this field to
-
getDoubleBuffer
public int getDoubleBuffer()Retrieves the double buffering value.- Returns:
- the current value of the doubleBuffer attribute
-
setStereo
public void setStereo(int value) Sets the stereo requirement. It should be GraphicsConfigTemplate.REQUIRED, GraphicsConfigTemplate.PREFERRED, or GraphicsConfigTemplate.UNNECESSARY. If an invalid value is passed in, it is ignored. If the value of stereo requirement is GraphicsConfigTemplate.REQUIRED, and no GraphicsConfiguration is found that meets this requirement, null will be returned in getBestConfiguration().- Parameters:
value- the value to set this field to
-
getStereo
public int getStereo()Retrieves the stereo value.- Returns:
- the current value of the stereo attribute.
-
setSceneAntialiasing
public void setSceneAntialiasing(int value) Sets the scene antialiasing requirement. It should be GraphicsConfigTemplate.REQUIRED, GraphicsConfigTemplate.PREFERRED, or GraphicsConfigTemplate.UNNECESSARY. If an invalid value is passed in, it is ignored. If the value of scene antialiasing is GraphicsConfigTemplate.REQUIRED, and no GraphicsConfiguration is found that meets this requirement, null will be returned in getBestConfiguration().- Parameters:
value- the value to set this field to
-
getSceneAntialiasing
public int getSceneAntialiasing()Retrieves the scene antialiasing value.- Returns:
- the current value of the scene antialiasing attribute.
-
setDepthSize
public void setDepthSize(int value) Sets the depth buffer size requirement. This is the minimum requirement. If no GraphicsConfiguration is found that meets or exceeds this minimum requirement, null will be returned in getBestConfiguration().- Parameters:
value- the value to set this field to
-
getDepthSize
public int getDepthSize()Retrieves the size of the depth buffer.- Returns:
- the current value of the depthSize attribute
-
setStencilSize
public void setStencilSize(int value) Sets the stencil buffer size requirement. This is the minimum requirement. If no GraphicsConfiguration is found that meets or exceeds this minimum requirement, null will be returned in getBestConfiguration().- Parameters:
value- the value to set this field to- Since:
- Java 3D 1.4
-
getStencilSize
public int getStencilSize()Retrieves the size of the stencil buffer.- Returns:
- the current value of the stencilSize attribute
- Since:
- Java 3D 1.4
-
setRedSize
public void setRedSize(int value) Sets the number of red bits required. This is the minimum requirement. If no GraphicsConfiguration is found that meets or exceeds this minimum requirement, null will be returned in getBestConfiguration().- Parameters:
value- the value to set this field to
-
getRedSize
public int getRedSize()Retrieves the number of red bits requested by this template.- Returns:
- the current value of the redSize attribute.
-
setGreenSize
public void setGreenSize(int value) Sets the number of green bits required. This is the minimum requirement. If no GraphicsConfiguration is found that meets or exceeds this minimum requirement, null will be returned in getBestConfiguration().- Parameters:
value- the value to set this field to
-
getGreenSize
public int getGreenSize()Retrieves the number of green bits requested by this template.- Returns:
- the current value of the greenSize attribute.
-
setBlueSize
public void setBlueSize(int value) Sets the number of blue bits required. This is the minimum requirement. If no GraphicsConfiguration is found that meets or exceeds this minimum requirement, null will be returned in getBestConfiguration().- Parameters:
value- the value to set this field to
-
getBlueSize
public int getBlueSize()Retrieves the number of blue bits requested by this template.- Returns:
- the current value of the blueSize attribute.
-
getBestConfiguration
Implement the abstract function of getBestConfiguration() in GraphicsConfigTemplate. Usually this function is not directly called by the user. It is implicitly called by getBestConfiguration() in GraphicsDevice. The method getBestConfiguration() in GraphicsDevice will return whatever this function returns. This function will return the "best" GraphicsConfiguration. The "best" GraphicsConfiguration means that this GraphicsConfiguration is supported and it meets or exceeds what was requested in the GraphicsConfigTemplate. If no such "best" GraphicsConfiguration is found, null is returned.- Specified by:
getBestConfigurationin classGraphicsConfigTemplate- Parameters:
gc- the array of GraphicsConfigurations to choose from- Returns:
- the best GraphicsConfiguration
- See Also:
-
isGraphicsConfigSupported
Returns a boolean indicating whether or not the given GraphicsConfiguration can be used to create a drawing surface that can be rendered to.- Specified by:
isGraphicsConfigSupportedin classGraphicsConfigTemplate- Parameters:
gc- the GraphicsConfiguration object to test- Returns:
trueif this GraphicsConfiguration object can be used to create surfaces that can be rendered to,falseif the GraphicsConfiguration can not be used to create a drawing surface usable by this API.
-
toString
Returns a string representation of this object.
-