diff options
author | Kenneth Russel <[email protected]> | 2005-11-09 23:40:41 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-11-09 23:40:41 +0000 |
commit | c01ade1249ca5175510a4d6a699ac0772c6b11d9 (patch) | |
tree | ac75b18ca28d586ddb80b9e17821022d5e69e8ab | |
parent | f35f87174f74988f1a2dbeab98b7529de0af3b36 (diff) |
Made public API changes discussed with expert group to make core JOGL
API more toolkit-agnostic:
1. Decoupled instantiation of GLCanvas and GLJPanel objects from the
GLDrawableFactory. GLCanvas and GLJPanel's constructors are now
public and the associated factory methods have been removed from
the GLDrawableFactory.
2. Changed the signature of GLDrawableFactory.
chooseGraphicsConfiguration() to accept and return marker
AbstractGraphicsDevice and AbstractGraphicsConfiguration
interfaces, respectively. Defined new AWTGraphicsDevice and
AWTGraphicsConfiguration wrapper classes simply wrapping the
associated objects. An SWT port could define similar wrapper
classes for its data types.
3. Allowed overriding of the specific GLDrawableFactory subclass
instantiated through GLDrawableFactory.getFactory() by setting the
system property "opengl.factory.class.name". For example, an SWT
port might swap itself in by specifying the following system
property on the command line:
-Dopengl.factory.class.name=com.ibm.swt.opengl.SWTGLDrawableFactory
Tested on Solaris/SPARC. Also fixed breakage on Solaris/SPARC due to
recent split of jogl native library into jogl and jogl_awt pieces.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/trunk@146 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
23 files changed, 33 insertions, 30 deletions
diff --git a/src/demos/context/DualContext.java b/src/demos/context/DualContext.java index 0f9fea9..6c43f42 100755 --- a/src/demos/context/DualContext.java +++ b/src/demos/context/DualContext.java @@ -62,7 +62,8 @@ public class DualContext extends Canvas { private int repaintNum; public DualContext(GLCapabilities capabilities) { - super(GLDrawableFactory.getFactory().chooseGraphicsConfiguration(capabilities, null, null)); + super(unwrap((AWTGraphicsConfiguration) + GLDrawableFactory.getFactory().chooseGraphicsConfiguration(capabilities, null, null))); drawable = GLDrawableFactory.getFactory().getGLDrawable(this, capabilities, null); context1 = drawable.createContext(null); context2 = drawable.createContext(null); @@ -142,4 +143,11 @@ public class DualContext extends Canvas { frame.setSize(800, 400); frame.setVisible(true); } + + private static GraphicsConfiguration unwrap(AWTGraphicsConfiguration config) { + if (config == null) { + return null; + } + return config.getGraphicsConfiguration(); + } } diff --git a/src/demos/fullscreen/GearsFullscreen.java b/src/demos/fullscreen/GearsFullscreen.java index c0a1345..3293250 100755 --- a/src/demos/fullscreen/GearsFullscreen.java +++ b/src/demos/fullscreen/GearsFullscreen.java @@ -52,7 +52,7 @@ public class GearsFullscreen { if (newMode != null) { frame.setUndecorated(true); } - final GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + final GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new Gears()); canvas.addGLEventListener(new FullscreenWorkaround(initWidth, initHeight)); diff --git a/src/demos/fullscreen/GearsFullscreen2.java b/src/demos/fullscreen/GearsFullscreen2.java index 1a5086c..902b3bc 100755 --- a/src/demos/fullscreen/GearsFullscreen2.java +++ b/src/demos/fullscreen/GearsFullscreen2.java @@ -53,7 +53,7 @@ public class GearsFullscreen2 { if (newMode != null) { frame.setUndecorated(true); } - GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new Gears()); canvas.addGLEventListener(new FullscreenWorkaround(initWidth, initHeight)); diff --git a/src/demos/gears/Gears.java b/src/demos/gears/Gears.java index 9382e40..666cb64 100644 --- a/src/demos/gears/Gears.java +++ b/src/demos/gears/Gears.java @@ -16,7 +16,7 @@ import com.sun.opengl.utils.*; public class Gears implements GLEventListener, MouseListener, MouseMotionListener { public static void main(String[] args) { Frame frame = new Frame("Gear Demo"); - GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new Gears()); frame.add(canvas); diff --git a/src/demos/hdr/HDR.java b/src/demos/hdr/HDR.java index 5cdf56b..07d036b 100755 --- a/src/demos/hdr/HDR.java +++ b/src/demos/hdr/HDR.java @@ -105,7 +105,7 @@ public class HDR extends Demo { 0.0f, 0.0f, 0.0f, 1.0f }; public static void main(String[] args) { - GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); HDR demo = new HDR(); canvas.addGLEventListener(demo); diff --git a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java index 0078df1..48167e9 100644 --- a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java +++ b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java @@ -61,7 +61,7 @@ import gleem.linalg.*; public class HWShadowmapsSimple extends Demo { public static void main(String[] args) { - final GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + final GLCanvas canvas = new GLCanvas(); HWShadowmapsSimple demo = new HWShadowmapsSimple(); canvas.addGLEventListener(demo); diff --git a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java index e35bdf0..5f4ce75 100644 --- a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java +++ b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java @@ -71,7 +71,7 @@ public class InfiniteShadowVolumes extends Demo { public static void main(String[] args) { GLCapabilities caps = new GLCapabilities(); caps.setStencilBits(16); - final GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(caps); + final GLCanvas canvas = new GLCanvas(caps); InfiniteShadowVolumes demo = new InfiniteShadowVolumes(); canvas.addGLEventListener(demo); diff --git a/src/demos/jrefract/JRefract.java b/src/demos/jrefract/JRefract.java index 60361e0..01fe9f7 100755 --- a/src/demos/jrefract/JRefract.java +++ b/src/demos/jrefract/JRefract.java @@ -120,7 +120,7 @@ public class JRefract { final GLJPanel canvas = (which == GEARS) ? new JGears() : - GLDrawableFactory.getFactory().createGLJPanel(caps); + new GLJPanel(caps); final DemoListener demoListener = new DemoListener() { public void shutdownDemo() { removeJPanel(canvas); diff --git a/src/demos/multisample/Multisample.java b/src/demos/multisample/Multisample.java index ff7d7ca..ed6ef62 100755 --- a/src/demos/multisample/Multisample.java +++ b/src/demos/multisample/Multisample.java @@ -84,7 +84,7 @@ public class Multisample { caps.setSampleBuffers(true); caps.setNumSamples(4); - canvas = GLDrawableFactory.getFactory().createGLCanvas(caps, chooser, null, null); + canvas = new GLCanvas(caps, chooser, null, null); canvas.addGLEventListener(new Listener()); Frame frame = new Frame("Full-scene antialiasing"); @@ -104,7 +104,7 @@ public class Multisample { // No antialiasing (for comparison) caps.setSampleBuffers(false); - canvas = GLDrawableFactory.getFactory().createGLCanvas(caps); + canvas = new GLCanvas(caps); canvas.addGLEventListener(new Listener()); frame = new Frame("No antialiasing"); diff --git a/src/demos/printext/PrintExt.java b/src/demos/printext/PrintExt.java index 4d21ee9..d73981a 100755 --- a/src/demos/printext/PrintExt.java +++ b/src/demos/printext/PrintExt.java @@ -12,7 +12,7 @@ import com.sun.opengl.utils.*; public class PrintExt { public static void main(String[] args) { Frame frame = new Frame(); - GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new Listener()); frame.setUndecorated(true); frame.add(canvas); diff --git a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java index 7599778..6fe2369 100644 --- a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java +++ b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java @@ -60,7 +60,7 @@ import gleem.linalg.*; public class ProceduralTexturePhysics extends Demo { public static void main(String[] args) { - GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); ProceduralTexturePhysics demo = new ProceduralTexturePhysics(); canvas.addGLEventListener(demo); diff --git a/src/demos/tess/Tess.java b/src/demos/tess/Tess.java index d4c9729..5c587c2 100644 --- a/src/demos/tess/Tess.java +++ b/src/demos/tess/Tess.java @@ -72,7 +72,7 @@ public class Tess { Frame frame = new Frame("Tess Demo"); frame.setSize(500, 500); - GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); frame.add(canvas); canvas.addGLEventListener(new TessRenderer()); diff --git a/src/demos/testContextDestruction/TestContextDestruction.java b/src/demos/testContextDestruction/TestContextDestruction.java index 86652bb..7f5fd64 100755 --- a/src/demos/testContextDestruction/TestContextDestruction.java +++ b/src/demos/testContextDestruction/TestContextDestruction.java @@ -68,7 +68,7 @@ public class TestContextDestruction { } public void run(String[] args) { - GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new Listener()); canvas.setSize(256, 256); diff --git a/src/demos/testContextSharing/TestContextSharing.java b/src/demos/testContextSharing/TestContextSharing.java index c6d7552..e63b3ad 100644 --- a/src/demos/testContextSharing/TestContextSharing.java +++ b/src/demos/testContextSharing/TestContextSharing.java @@ -56,14 +56,14 @@ public class TestContextSharing { } public void run(String[] args) { - GLCanvas canvas1 = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas1 = new GLCanvas(); canvas1.addGLEventListener(new Listener()); canvas1.setSize(256, 256); Frame frame1 = new Frame("Canvas 1"); frame1.setLayout(new BorderLayout()); frame1.add(canvas1, BorderLayout.CENTER); - GLCanvas canvas2 = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities(), null, canvas1.getContext(), null); + GLCanvas canvas2 = new GLCanvas(null, null, canvas1.getContext(), null); canvas2.addGLEventListener(new Listener()); canvas2.setSize(256, 256); Frame frame2 = new Frame("Canvas 2"); diff --git a/src/demos/vertexArrayRange/VertexArrayRange.java b/src/demos/vertexArrayRange/VertexArrayRange.java index 60d2ba8..dcf6df4 100644 --- a/src/demos/vertexArrayRange/VertexArrayRange.java +++ b/src/demos/vertexArrayRange/VertexArrayRange.java @@ -93,7 +93,7 @@ public class VertexArrayRange extends Demo { } } - GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); VertexArrayRange demo = new VertexArrayRange(); if (startSlow) { demo.setFlag('v', false); // VAR off diff --git a/src/demos/vertexBufferObject/VertexBufferObject.java b/src/demos/vertexBufferObject/VertexBufferObject.java index ef485bd..6d5224d 100644 --- a/src/demos/vertexBufferObject/VertexBufferObject.java +++ b/src/demos/vertexBufferObject/VertexBufferObject.java @@ -85,7 +85,7 @@ public class VertexBufferObject extends Demo { } } - GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); VertexBufferObject demo = new VertexBufferObject(); demo.vboEnabled = vboEnabled; canvas.addGLEventListener(demo); diff --git a/src/demos/vertexProgRefract/VertexProgRefract.java b/src/demos/vertexProgRefract/VertexProgRefract.java index 63b4a59..8663d39 100644 --- a/src/demos/vertexProgRefract/VertexProgRefract.java +++ b/src/demos/vertexProgRefract/VertexProgRefract.java @@ -66,7 +66,7 @@ import gleem.linalg.*; public class VertexProgRefract extends Demo { public static void main(String[] args) { - GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); VertexProgRefract demo = new VertexProgRefract(); canvas.addGLEventListener(demo); diff --git a/src/demos/vertexProgWarp/VertexProgWarp.java b/src/demos/vertexProgWarp/VertexProgWarp.java index cd39a01..07605e8 100644 --- a/src/demos/vertexProgWarp/VertexProgWarp.java +++ b/src/demos/vertexProgWarp/VertexProgWarp.java @@ -72,7 +72,7 @@ public class VertexProgWarp extends Demo { } public void run(String[] args) { - GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); VertexProgWarp demo = new VertexProgWarp(); canvas.addGLEventListener(demo); diff --git a/src/gleem/TestExaminerViewer.java b/src/gleem/TestExaminerViewer.java index 7e52992..d7e4734 100644 --- a/src/gleem/TestExaminerViewer.java +++ b/src/gleem/TestExaminerViewer.java @@ -143,8 +143,7 @@ public class TestExaminerViewer { } }); frame.setLayout(new BorderLayout()); - GLCanvas canvas = - GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); canvas.setSize(400, 400); canvas.addGLEventListener(new Listener()); frame.add(canvas, BorderLayout.CENTER); diff --git a/src/gleem/TestHandleBox.java b/src/gleem/TestHandleBox.java index e06d004..8df7fd6 100644 --- a/src/gleem/TestHandleBox.java +++ b/src/gleem/TestHandleBox.java @@ -133,8 +133,7 @@ public class TestHandleBox { } }); frame.setLayout(new BorderLayout()); - GLCanvas canvas = - GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); canvas.setSize(400, 400); canvas.addGLEventListener(new Listener()); frame.add(canvas, BorderLayout.CENTER); diff --git a/src/gleem/TestMultiWin.java b/src/gleem/TestMultiWin.java index 1a1fcf1..7d73583 100644 --- a/src/gleem/TestMultiWin.java +++ b/src/gleem/TestMultiWin.java @@ -142,8 +142,7 @@ public class TestMultiWin { } }); frame.setLayout(new BorderLayout()); - GLCanvas canvas = - GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); canvas.setSize(400, 400); canvas.addGLEventListener(new Listener()); frame.add(canvas, BorderLayout.CENTER); diff --git a/src/gleem/TestTranslate1.java b/src/gleem/TestTranslate1.java index b9eb81a..93a97d0 100644 --- a/src/gleem/TestTranslate1.java +++ b/src/gleem/TestTranslate1.java @@ -134,8 +134,7 @@ public class TestTranslate1 { } }); frame.setLayout(new BorderLayout()); - GLCanvas canvas = - GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); canvas.setSize(400, 400); canvas.addGLEventListener(new Listener()); frame.add(canvas, BorderLayout.CENTER); diff --git a/src/gleem/TestTranslate2.java b/src/gleem/TestTranslate2.java index 96f5684..e507b07 100644 --- a/src/gleem/TestTranslate2.java +++ b/src/gleem/TestTranslate2.java @@ -134,8 +134,7 @@ public class TestTranslate2 { } }); frame.setLayout(new BorderLayout()); - GLCanvas canvas = - GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + GLCanvas canvas = new GLCanvas(); canvas.setSize(400, 400); canvas.addGLEventListener(new Listener()); frame.add(canvas, BorderLayout.CENTER); |