gl4java.drawable
Class GLDrawableFactory

java.lang.Object
  |
  +--gl4java.drawable.GLDrawableFactory
Direct Known Subclasses:
DummyGLDrawableFactory, SunJDK13GLDrawableFactory

public abstract class GLDrawableFactory
extends java.lang.Object

Provides a VM- and OS-independent mechanism for creating GLAnimCanvas, GLCanvas, GLAnimJPanel and GLJPanel objects. Most useful when used in conjunction with the GLEventListener model, where subclassing is not required.

The GLCapabilities objects passed in to the various factory methods are used as a minimum specification for the properties of the returned GLCanvas. The canvas will either meet or exceed all of the integer properties such as color and accumulation buffer depth and will match all of the boolean properties such as enabling or disabling of stereo. The selection algorithm in general attempts to select the most minimal window type to meet the criteria, but is otherwise left loosely specified.

The implementing class of this abstract factory methods does clone your given GLCapabilities. So your version is unchanged. The GLContext's GLCapabilites instance is changed to the used capabilities, so you can query GLContext's GLCapabilites!

It is currently not possible to specify GLCapabilities for lightweight components.


Constructor Summary
GLDrawableFactory()
           
 
Method Summary
 GLAnimCanvas createGLAnimCanvas(GLCapabilities capabilities, int width, int height)
          Create a new GLAnimCanvas given the specified GLCapabilities.
abstract  GLAnimCanvas createGLAnimCanvas(GLCapabilities capabilities, int width, int height, java.lang.String glName, java.lang.String gluName)
          Create a new GLAnimCanvas given the specified GLCapabilities.
 GLAnimJPanel createGLAnimJPanel()
          Create a new GLAnimJPanel.
 GLAnimJPanel createGLAnimJPanel(java.lang.String glName, java.lang.String gluName, java.awt.LayoutManager layout, boolean isDoubleBuffered)
          Create a new GLAnimJPanel with the specified GL/GLU library names, LayoutManager, and double buffering specification.
 GLCanvas createGLCanvas(GLCapabilities capabilities, int width, int height)
          Create a new GLCanvas given the specified GLCapabilities.
abstract  GLCanvas createGLCanvas(GLCapabilities capabilities, int width, int height, java.lang.String glName, java.lang.String gluName)
          Create a new GLCanvas given the specified GLCapabilities.
 GLJPanel createGLJPanel()
          Create a new GLJPanel.
 GLJPanel createGLJPanel(java.lang.String glName, java.lang.String gluName, java.awt.LayoutManager layout, boolean isDoubleBuffered)
          Create a new GLJPanel with the specified GL/GLU library names, LayoutManager, and double buffering specification.
static GLDrawableFactory getFactory()
          Returns the sole instance of the GLCanvasFactory (singleton pattern).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GLDrawableFactory

public GLDrawableFactory()
Method Detail

getFactory

public static GLDrawableFactory getFactory()
Returns the sole instance of the GLCanvasFactory (singleton pattern).

createGLAnimCanvas

public GLAnimCanvas createGLAnimCanvas(GLCapabilities capabilities,
                                       int width,
                                       int height)
Create a new GLAnimCanvas given the specified GLCapabilities.
Parameters:
capabilities - the requested set of OpenGL capabilities of the canvas
width - the canvas's initial width
height - the canvas's initial height
Returns:
a GLAnimCanvas supporting the set of specified capabilities, or null if there was no matching visual

createGLAnimCanvas

public abstract GLAnimCanvas createGLAnimCanvas(GLCapabilities capabilities,
                                                int width,
                                                int height,
                                                java.lang.String glName,
                                                java.lang.String gluName)
Create a new GLAnimCanvas given the specified GLCapabilities.
Parameters:
capabilities - the requested set of OpenGL capabilities of the canvas
width - the canvas's initial width
height - the canvas's initial height
glName - the name of the GLFunc implementation. If null, the default class will be used
gluName - the name of the GLUFunc implementation. If null, the default class will be used
Returns:
a GLAnimCanvas supporting the set of specified capabilities, or null if there was no matching visual

createGLCanvas

public GLCanvas createGLCanvas(GLCapabilities capabilities,
                               int width,
                               int height)
Create a new GLCanvas given the specified GLCapabilities.
Parameters:
capabilities - the requested set of OpenGL capabilities of the canvas
width - the canvas's initial width
height - the canvas's initial height
Returns:
a GLCanvas supporting the set of specified capabilities, or null if there was no matching visual

createGLCanvas

public abstract GLCanvas createGLCanvas(GLCapabilities capabilities,
                                        int width,
                                        int height,
                                        java.lang.String glName,
                                        java.lang.String gluName)
Create a new GLCanvas given the specified GLCapabilities.
Parameters:
capabilities - the requested set of OpenGL capabilities of the canvas
width - the canvas's initial width
height - the canvas's initial height
glName - the name of the GLFunc implementation. If null, the default class will be used
gluName - the name of the GLUFunc implementation. If null, the default class will be used
Returns:
a GLCanvas supporting the set of specified capabilities, or null if there was no matching visual

createGLAnimJPanel

public GLAnimJPanel createGLAnimJPanel()
Create a new GLAnimJPanel.

createGLAnimJPanel

public GLAnimJPanel createGLAnimJPanel(java.lang.String glName,
                                       java.lang.String gluName,
                                       java.awt.LayoutManager layout,
                                       boolean isDoubleBuffered)
Create a new GLAnimJPanel with the specified GL/GLU library names, LayoutManager, and double buffering specification.
Parameters:
glName - the name of the GLFunc implementation. If null, the default class will be used
gluName - the name of the GLUFunc implementation. If null, the default class will be used
layout - the layout manager
isDoubleBuffered - indicates if double buffering should be used

createGLJPanel

public GLJPanel createGLJPanel()
Create a new GLJPanel.

createGLJPanel

public GLJPanel createGLJPanel(java.lang.String glName,
                               java.lang.String gluName,
                               java.awt.LayoutManager layout,
                               boolean isDoubleBuffered)
Create a new GLJPanel with the specified GL/GLU library names, LayoutManager, and double buffering specification.
Parameters:
glName - the name of the GLFunc implementation. If null, the default class will be used
gluName - the name of the GLUFunc implementation. If null, the default class will be used
layout - the layout manager
isDoubleBuffered - indicates if double buffering should be used