Class GraphicsConfigTemplate3D

java.lang.Object
java.awt.GraphicsConfigTemplate
javax.media.j3d.GraphicsConfigTemplate3D
All Implemented Interfaces:
Serializable

public class GraphicsConfigTemplate3D extends GraphicsConfigTemplate
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:
  • 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

      public GraphicsConfiguration getBestConfiguration(GraphicsConfiguration[] gc)
      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:
      getBestConfiguration in class GraphicsConfigTemplate
      Parameters:
      gc - the array of GraphicsConfigurations to choose from
      Returns:
      the best GraphicsConfiguration
      See Also:
    • isGraphicsConfigSupported

      public boolean isGraphicsConfigSupported(GraphicsConfiguration gc)
      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:
      isGraphicsConfigSupported in class GraphicsConfigTemplate
      Parameters:
      gc - the GraphicsConfiguration object to test
      Returns:
      true if this GraphicsConfiguration object can be used to create surfaces that can be rendered to, false if the GraphicsConfiguration can not be used to create a drawing surface usable by this API.
    • toString

      public String toString()
      Returns a string representation of this object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this object.