net.java.games.jogl
Class GLDrawableFactory

java.lang.Object
  extended bynet.java.games.jogl.GLDrawableFactory

public class GLDrawableFactory
extends Object

Provides a virtual machine- and operating system-independent mechanism for creating GLCanvas and GLJPanel objects.

The GLCapabilities objects passed in to the various factory methods are used as a hint for the properties of the returned drawable. The default capabilities selection algorithm (equivalent to passing in a null GLCapabilitiesChooser) is described in DefaultGLCapabilitiesChooser. Sophisticated applications needing to change the selection algorithm may pass in their own GLCapabilitiesChooser which can select from the available pixel formats.

Because of the multithreaded nature of the Java platform's window system toolkit, it is typically not possible to immediately reject a given GLCapabilities as being unsupportable by either returning null from the creation routines or raising a GLException. The semantics of the rejection process are (unfortunately) left unspecified for now. The current implementation will cause a GLException to be raised during the first repaint of the GLCanvas or GLJPanel if the capabilities can not be met.


Method Summary
 GLCanvas createGLCanvas(GLCapabilities capabilities)
          Creates a GLCanvas on the default graphics device with the specified capabilities using the default capabilities selection algorithm.
 GLCanvas createGLCanvas(GLCapabilities capabilities, GLCapabilitiesChooser chooser)
          Creates a GLCanvas on the default graphics device with the specified capabilities using the supplied capabilities selection algorithm.
 GLCanvas createGLCanvas(GLCapabilities capabilities, GLCapabilitiesChooser chooser, GLDrawable shareWith)
          Creates a GLCanvas on the default graphics device with the specified capabilities using the supplied capabilities selection algorithm.
 GLCanvas createGLCanvas(GLCapabilities capabilities, GLCapabilitiesChooser chooser, GLDrawable shareWith, GraphicsDevice device)
          Creates a GLCanvas on the specified graphics device with the specified capabilities using the supplied capabilities selection algorithm.
 GLCanvas createGLCanvas(GLCapabilities capabilities, GLDrawable shareWith)
          Creates a GLCanvas on the default graphics device with the specified capabilities using the default capabilities selection algorithm.
 GLJPanel createGLJPanel(GLCapabilities capabilities)
          Creates a GLJPanel with the specified capabilities using the default capabilities selection algorithm.
 GLJPanel createGLJPanel(GLCapabilities capabilities, GLCapabilitiesChooser chooser)
          Creates a GLJPanel with the specified capabilities using the supplied capabilities selection algorithm.
 GLJPanel createGLJPanel(GLCapabilities capabilities, GLCapabilitiesChooser chooser, GLDrawable shareWith)
          Creates a GLJPanel with the specified capabilities using the supplied capabilities selection algorithm.
 GLJPanel createGLJPanel(GLCapabilities capabilities, GLDrawable shareWith)
          Creates a GLJPanel with the specified capabilities using the default capabilities selection algorithm.
static GLDrawableFactory getFactory()
          Returns the sole GLDrawableFactory instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFactory

public static GLDrawableFactory getFactory()
Returns the sole GLDrawableFactory instance.


createGLCanvas

public GLCanvas createGLCanvas(GLCapabilities capabilities)
Creates a GLCanvas on the default graphics device with the specified capabilities using the default capabilities selection algorithm.


createGLCanvas

public GLCanvas createGLCanvas(GLCapabilities capabilities,
                               GLDrawable shareWith)
Creates a GLCanvas on the default graphics device with the specified capabilities using the default capabilities selection algorithm. The canvas will share textures and display lists with the specified GLDrawable; the drawable must either be null or have been fabricated from this factory or by classes in this package. A null drawable indicates no sharing.


createGLCanvas

public GLCanvas createGLCanvas(GLCapabilities capabilities,
                               GLCapabilitiesChooser chooser)
Creates a GLCanvas on the default graphics device with the specified capabilities using the supplied capabilities selection algorithm. A null chooser is equivalent to using the DefaultGLCapabilitiesChooser.


createGLCanvas

public GLCanvas createGLCanvas(GLCapabilities capabilities,
                               GLCapabilitiesChooser chooser,
                               GLDrawable shareWith)
Creates a GLCanvas on the default graphics device with the specified capabilities using the supplied capabilities selection algorithm. A null chooser is equivalent to using the DefaultGLCapabilitiesChooser. The canvas will share textures and display lists with the specified GLDrawable; the drawable must either be null or have been fabricated from this factory or by classes in this package. A null drawable indicates no sharing.


createGLCanvas

public GLCanvas createGLCanvas(GLCapabilities capabilities,
                               GLCapabilitiesChooser chooser,
                               GLDrawable shareWith,
                               GraphicsDevice device)
Creates a GLCanvas on the specified graphics device with the specified capabilities using the supplied capabilities selection algorithm. A null chooser is equivalent to using the DefaultGLCapabilitiesChooser. The canvas will share textures and display lists with the specified GLDrawable; the drawable must either be null or have been fabricated from this factory or by classes in this package. A null drawable indicates no sharing. A null GraphicsDevice is equivalent to using that returned from GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().


createGLJPanel

public GLJPanel createGLJPanel(GLCapabilities capabilities)
Creates a GLJPanel with the specified capabilities using the default capabilities selection algorithm.


createGLJPanel

public GLJPanel createGLJPanel(GLCapabilities capabilities,
                               GLDrawable shareWith)
Creates a GLJPanel with the specified capabilities using the default capabilities selection algorithm. The panel will share textures and display lists with the specified GLDrawable; the drawable must either be null or have been fabricated from this factory or by classes in this package. A null drawable indicates no sharing.


createGLJPanel

public GLJPanel createGLJPanel(GLCapabilities capabilities,
                               GLCapabilitiesChooser chooser)
Creates a GLJPanel with the specified capabilities using the supplied capabilities selection algorithm. A null chooser is equivalent to using the DefaultGLCapabilitiesChooser.


createGLJPanel

public GLJPanel createGLJPanel(GLCapabilities capabilities,
                               GLCapabilitiesChooser chooser,
                               GLDrawable shareWith)
Creates a GLJPanel with the specified capabilities using the supplied capabilities selection algorithm. A null chooser is equivalent to using the DefaultGLCapabilitiesChooser. The panel will share textures and display lists with the specified GLDrawable; the drawable must either be null or have been fabricated from this factory or by classes in this package. A null drawable indicates no sharing.