aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/GLCanvas.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-07-19 01:00:42 +0000
committerKenneth Russel <[email protected]>2005-07-19 01:00:42 +0000
commit730e752dc282ab4230e6fc80d934011bffdc6007 (patch)
tree419398176a9d7d1e47be48fa53ad9fc1b8f13143 /src/net/java/games/jogl/GLCanvas.java
parent35435c313ba527c9bea35a14f72492d2f80a9c84 (diff)
Moved all functionality from GLContextFactory implementations into
concrete GLDrawableFactory implementations. Made GLDrawableFactory abstract and added GLDrawableFactoryImpl to support creation of offscreen GLDrawables for non-pbuffer fallback path of GLJPanel. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@329 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/jogl/GLCanvas.java')
-rw-r--r--src/net/java/games/jogl/GLCanvas.java31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/net/java/games/jogl/GLCanvas.java b/src/net/java/games/jogl/GLCanvas.java
index 3d9df841b..1089a22cb 100644
--- a/src/net/java/games/jogl/GLCanvas.java
+++ b/src/net/java/games/jogl/GLCanvas.java
@@ -60,7 +60,7 @@ import net.java.games.jogl.impl.*;
public class GLCanvas extends Canvas implements GLAutoDrawable {
- protected static final boolean DEBUG = Debug.debug("GLCanvas");
+ private static final boolean DEBUG = Debug.debug("GLCanvas");
private GLDrawableHelper drawableHelper = new GLDrawableHelper();
private GLDrawable drawable;
@@ -68,10 +68,31 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
private boolean autoSwapBufferMode = true;
private boolean sendReshape = false;
- public GLCanvas(GLCapabilities capabilities,
- GLCapabilitiesChooser chooser,
- GLContext shareWith,
- GraphicsDevice device) {
+ /** Creates a new GLCanvas object. The passed GLCapabilities must be
+ non-null and specifies the OpenGL capabilities for the
+ component. The GLCapabilitiesChooser must be non-null and
+ specifies the algorithm for selecting one of the available
+ GLCapabilities for the component; the GLDrawableFactory uses a
+ DefaultGLCapabilitesChooser if the user does not provide
+ one. The passed GLContext may be null and specifies an OpenGL
+ context with which to share textures, display lists and other
+ OpenGL state. The passed GraphicsDevice must be non-null and
+ indicates the screen on which to create the GLCanvas; the
+ GLDrawableFactory uses the default screen device of the local
+ GraphicsEnvironment if the user does not provide one. */
+ protected GLCanvas(GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser,
+ GLContext shareWith,
+ GraphicsDevice device) {
+ // The platform-specific GLDrawableFactory will only provide a
+ // non-null GraphicsConfiguration on platforms where this is
+ // necessary (currently only X11, as Windows allows the pixel
+ // format of the window to be set later and Mac OS X seems to
+ // handle this very differently than all other platforms). On
+ // other platforms this method returns null; it is the case (at
+ // least in the Sun AWT implementation) that this will result in
+ // equivalent behavior to calling the no-arg super() constructor
+ // for Canvas.
super(GLDrawableFactory.getFactory().chooseGraphicsConfiguration(capabilities, chooser, device));
drawable = GLDrawableFactory.getFactory().getGLDrawable(this, capabilities, chooser);
context = (GLContextImpl) drawable.createContext(shareWith);