diff options
author | Kenneth Russel <[email protected]> | 2009-03-19 00:33:27 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2009-03-19 00:33:27 +0000 |
commit | 4433fd7343f1161a4def7152cff68d3fb8fcbb5d (patch) | |
tree | ca6b5beac19214147b2fc9e81b5cb98b4f9b7cbf /src | |
parent | aefbc0323da190835bc146709bf560b3e3181b39 (diff) |
Updated demos after refactoring of OpenGL capability bits back into GLCapabilities
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@323 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src')
30 files changed, 88 insertions, 95 deletions
diff --git a/src/demos/GLInfo.java b/src/demos/GLInfo.java index f2c9d2c..58f67f1 100755 --- a/src/demos/GLInfo.java +++ b/src/demos/GLInfo.java @@ -1,7 +1,6 @@ package demos; import java.nio.*; -import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.util.*; import javax.media.opengl.glu.*; @@ -19,13 +18,13 @@ public class GLInfo implements GLEventListener { System.err.println("GLInfo.run()"); GLProfile.setProfileGLAny(); try { - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); caps.setBlueBits(5); caps.setDepthBits(16); - System.err.println("NWCapabilities PRE : "+caps); + System.err.println("GLCapabilities PRE : "+caps); Window nWindow = null; if(0!=(type&USE_AWT)) { @@ -57,7 +56,7 @@ public class GLInfo implements GLEventListener { public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); - System.err.println("NWCapabilities POST: "+drawable.getChosenNWCapabilities()); + System.err.println("GLCapabilities POST: "+drawable.getChosenGLCapabilities()); System.err.println("GL Profile: "+GLProfile.getProfile()); System.err.println("GL:" + gl); System.err.println("GL_VERSION: " + gl.glGetString(GL.GL_VERSION)); diff --git a/src/demos/context/DualContext.java b/src/demos/context/DualContext.java index c30c851..30e36b4 100755 --- a/src/demos/context/DualContext.java +++ b/src/demos/context/DualContext.java @@ -46,8 +46,8 @@ import java.awt.Graphics; import java.awt.GraphicsConfiguration; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.media.nwi.*; -import javax.media.nwi.awt.*; +import javax.media.nativewindow.*; +import javax.media.nativewindow.awt.*; import javax.media.opengl.*; import javax.media.opengl.awt.*; import javax.media.opengl.glu.GLU; @@ -71,9 +71,9 @@ public class DualContext extends Canvas { private GLUT glut; private int repaintNum; - public DualContext(NWCapabilities capabilities) { + public DualContext(GLCapabilities capabilities) { super(unwrap((AWTGraphicsConfiguration) - NativeWindowFactory.getFactory(Canvas.class).chooseGraphicsConfiguration(capabilities, null, null))); + GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(capabilities, null, null))); NativeWindow win = NativeWindowFactory.getFactory(getClass()).getNativeWindow(this); drawable = GLDrawableFactory.getFactory().createGLDrawable(win, capabilities, null); context1 = drawable.createContext(null); @@ -141,7 +141,9 @@ public class DualContext extends Canvas { public static void main(String[] args) { JFrame frame = new JFrame("Dual OpenGL Context Test"); - final DualContext dc = new DualContext(new NWCapabilities()); + // Get the GraphicsConfigurationFactory ready for OpenGL work + GLDrawableFactory.getFactory(); + final DualContext dc = new DualContext(new GLCapabilities()); frame.getContentPane().add(dc, BorderLayout.CENTER); JButton button = new JButton("Repaint"); button.addActionListener(new ActionListener() { diff --git a/src/demos/cubefbo/Main.java b/src/demos/cubefbo/Main.java index 0756005..34a7e0c 100755 --- a/src/demos/cubefbo/Main.java +++ b/src/demos/cubefbo/Main.java @@ -36,7 +36,7 @@ package demos.cubefbo; import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import javax.media.nwi.NWCapabilities; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.awt.GLCanvas; import com.sun.opengl.util.Animator; import com.sun.opengl.util.FPSAnimator; @@ -46,7 +46,7 @@ public class Main { public static void main(String[] args) { - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); GLCanvas canvas = new GLCanvas(caps); FBCubes cubes = new FBCubes(); diff --git a/src/demos/es1/Info.java b/src/demos/es1/Info.java index 13cf038..7a675a7 100755 --- a/src/demos/es1/Info.java +++ b/src/demos/es1/Info.java @@ -1,7 +1,6 @@ package demos.es1; import java.nio.*; -import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.util.*; import javax.media.opengl.glu.*; @@ -19,7 +18,7 @@ public class Info implements GLEventListener { System.err.println("Info.run()"); GLProfile.setProfileGL2ES1(); try { - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index 1de39c6..f5bc050 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -1,7 +1,6 @@ package demos.es1; import java.nio.*; -import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; @@ -66,7 +65,7 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL System.err.println("RedSquare.run()"); GLProfile.setProfileGLAny(); try { - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); diff --git a/src/demos/es1/angeles/Main.java b/src/demos/es1/angeles/Main.java index 9a97305..30aed45 100755 --- a/src/demos/es1/angeles/Main.java +++ b/src/demos/es1/angeles/Main.java @@ -1,7 +1,6 @@ package demos.es1.angeles; import java.nio.*; -import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.javafx.newt.*; import com.sun.javafx.newt.opengl.*; @@ -43,7 +42,7 @@ public class Main implements WindowListener, MouseListener { GLProfile.setProfileGLAny(); try { // Hook this into EGL - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); diff --git a/src/demos/es1/cube/Cube.java b/src/demos/es1/cube/Cube.java index e472af0..59b4514 100644 --- a/src/demos/es1/cube/Cube.java +++ b/src/demos/es1/cube/Cube.java @@ -32,7 +32,6 @@ package demos.es1.cube; import java.nio.*; -import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; @@ -293,7 +292,7 @@ public class Cube implements GLEventListener { System.err.println("Cube.run()"); GLProfile.setProfileGLAny(); try { - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); diff --git a/src/demos/es1/cube/CubeImmModeSink.java b/src/demos/es1/cube/CubeImmModeSink.java index 9a9d7cf..341889e 100644 --- a/src/demos/es1/cube/CubeImmModeSink.java +++ b/src/demos/es1/cube/CubeImmModeSink.java @@ -31,7 +31,6 @@ */ package demos.es1.cube; -import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; @@ -383,7 +382,7 @@ public class CubeImmModeSink implements GLEventListener { System.err.println("CubeImmModeSink.run()"); GLProfile.setProfileGLAny(); try { - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); diff --git a/src/demos/es1/cubefbo/Main.java b/src/demos/es1/cubefbo/Main.java index 5b46773..b299ca4 100755 --- a/src/demos/es1/cubefbo/Main.java +++ b/src/demos/es1/cubefbo/Main.java @@ -1,7 +1,6 @@ package demos.es1.cubefbo; import java.nio.*; -import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.javafx.newt.*; import com.sun.javafx.newt.opengl.*; @@ -50,7 +49,7 @@ public class Main implements WindowListener, MouseListener { GLProfile.setProfileGLAny(); try { // Hook this into EGL - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java index 647434a..9218cd8 100755 --- a/src/demos/es2/RedSquare.java +++ b/src/demos/es2/RedSquare.java @@ -1,7 +1,6 @@ package demos.es2; import java.nio.*; -import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; @@ -51,7 +50,7 @@ public class RedSquare implements MouseListener, GLEventListener { System.err.println("RedSquare.run()"); GLProfile.setProfileGL2ES2(); try { - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); diff --git a/src/demos/es2/openmax/Cube.java b/src/demos/es2/openmax/Cube.java index 44f607c..d993522 100644 --- a/src/demos/es2/openmax/Cube.java +++ b/src/demos/es2/openmax/Cube.java @@ -31,7 +31,6 @@ */ package demos.es2.openmax; -import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; @@ -310,7 +309,7 @@ public class Cube implements GLEventListener { System.err.println("Cube.run()"); GLProfile.setProfileGLAny(); try { - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); diff --git a/src/demos/es2/openmax/MovieCube.java b/src/demos/es2/openmax/MovieCube.java index 75fba14..94e4044 100755 --- a/src/demos/es2/openmax/MovieCube.java +++ b/src/demos/es2/openmax/MovieCube.java @@ -35,7 +35,6 @@ package demos.es2.openmax; // import demos.es1.cube.Cube; -import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.util.*; import javax.media.opengl.sub.fixed.*; @@ -88,7 +87,7 @@ public class MovieCube implements MouseListener, GLEventListener, OMXEventListen System.err.println("MovieCube.run()"); GLProfile.setProfileGL2ES2(); try { - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); diff --git a/src/demos/es2/openmax/MovieSimple.java b/src/demos/es2/openmax/MovieSimple.java index 376c576..529340d 100755 --- a/src/demos/es2/openmax/MovieSimple.java +++ b/src/demos/es2/openmax/MovieSimple.java @@ -34,7 +34,6 @@ package demos.es2.openmax; -import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.util.*; @@ -95,7 +94,7 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList System.err.println("MovieSimple.run()"); GLProfile.setProfileGL2ES2(); try { - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); diff --git a/src/demos/es2/perftst/Perftst.java b/src/demos/es2/perftst/Perftst.java index 35edf82..40dbbca 100755 --- a/src/demos/es2/perftst/Perftst.java +++ b/src/demos/es2/perftst/Perftst.java @@ -1,14 +1,11 @@ package demos.es2.perftst; import java.nio.*; -import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.util.*; import com.sun.opengl.util.glsl.*; -import com.sun.nwi.impl.NWReflection; - import com.sun.javafx.newt.*; import com.sun.javafx.newt.opengl.*; @@ -45,7 +42,7 @@ public class Perftst implements MouseListener, GLEventListener { System.err.println("Perftst.run()"); GLProfile.setProfileGL2ES2(); try { - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); @@ -174,8 +171,13 @@ public class Perftst implements MouseListener, GLEventListener { } } - PerfModule pmod = (PerfModule) NWReflection.createInstance(tstName); - new Perftst().run(type, pmod); - System.exit(0); + try { + PerfModule pmod = (PerfModule) Class.forName(tstName).newInstance(); + new Perftst().run(type, pmod); + System.exit(0); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } } } diff --git a/src/demos/gears/Gears.java b/src/demos/gears/Gears.java index 4b2e431..2107014 100644 --- a/src/demos/gears/Gears.java +++ b/src/demos/gears/Gears.java @@ -67,7 +67,7 @@ public class Gears implements GLEventListener, MouseListener, MouseMotionListene System.err.println("INIT GL IS: " + gl.getClass().getName()); - System.err.println("Chosen NWCapabilities: " + drawable.getChosenNWCapabilities()); + System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities()); gl.setSwapInterval(1); diff --git a/src/demos/hdr/HDR.java b/src/demos/hdr/HDR.java index 2c86f30..14eb63b 100755 --- a/src/demos/hdr/HDR.java +++ b/src/demos/hdr/HDR.java @@ -30,7 +30,7 @@ import javax.media.opengl.GL; import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; -import javax.media.nwi.NWCapabilities; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLEventListener; @@ -307,7 +307,7 @@ public class HDR extends Demo { // Workaround for apparent bug when not using render-to-texture-rectangle int floatDepthBits = 1; - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); caps.setDoubleBuffered(false); caps.setPbufferFloatingPointBuffers(true); caps.setRedBits(floatBits); diff --git a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java index 160e363..23c9d86 100644 --- a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java +++ b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java @@ -60,7 +60,7 @@ import javax.media.opengl.GL; import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; -import javax.media.nwi.NWCapabilities; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLException; @@ -270,7 +270,7 @@ public class HWShadowmapsSimple extends Demo { gl.glEnable(GL2.GL_DEPTH_TEST); // init pbuffer - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); caps.setDoubleBuffered(false); if (!GLDrawableFactory.getFactory().canCreateGLPbuffer()) { diff --git a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java index ef4d67a..47ee213 100644 --- a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java +++ b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java @@ -60,7 +60,7 @@ import javax.media.opengl.GL; import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; -import javax.media.nwi.NWCapabilities; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.awt.AWTGLAutoDrawable; import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.glu.GLU; @@ -86,7 +86,7 @@ import javax.media.opengl.glu.GLU; public class InfiniteShadowVolumes extends Demo { public static void main(String[] args) { - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); caps.setStencilBits(16); final GLCanvas canvas = new GLCanvas(caps); InfiniteShadowVolumes demo = new InfiniteShadowVolumes(); diff --git a/src/demos/j2d/TestOverlay.java b/src/demos/j2d/TestOverlay.java index 59dcd8f..b0cd597 100755 --- a/src/demos/j2d/TestOverlay.java +++ b/src/demos/j2d/TestOverlay.java @@ -54,9 +54,9 @@ import java.awt.event.WindowEvent; import java.awt.font.FontRenderContext; import java.awt.font.GlyphVector; import java.text.DecimalFormat; -import javax.media.nwi.NWCapabilities; import javax.media.opengl.GL; import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLEventListener; import javax.media.opengl.awt.GLCanvas; import com.sun.opengl.util.Animator; @@ -67,7 +67,7 @@ import com.sun.opengl.util.Animator; public class TestOverlay implements GLEventListener { public static void main(String[] args) { Frame frame = new Frame("Java 2D Overlay Test"); - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); caps.setAlphaBits(8); GLCanvas canvas = new GLCanvas(caps); canvas.addGLEventListener(new Gears()); diff --git a/src/demos/j2d/TestTextRenderer.java b/src/demos/j2d/TestTextRenderer.java index 4737ac5..835a2a9 100755 --- a/src/demos/j2d/TestTextRenderer.java +++ b/src/demos/j2d/TestTextRenderer.java @@ -52,7 +52,7 @@ import java.awt.event.WindowEvent; import java.awt.geom.Rectangle2D; import javax.media.opengl.GL; import javax.media.opengl.GLAutoDrawable; -import javax.media.nwi.NWCapabilities; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLEventListener; import javax.media.opengl.awt.GLCanvas; import com.sun.opengl.util.Animator; @@ -66,7 +66,7 @@ public class TestTextRenderer implements GLEventListener { public static void main(String[] args) { Frame frame = new Frame("Text Renderer Test"); - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); caps.setAlphaBits(8); GLCanvas canvas = new GLCanvas(caps); canvas.addGLEventListener(new Gears()); diff --git a/src/demos/j2d/TestTextureRenderer.java b/src/demos/j2d/TestTextureRenderer.java index 13afdfe..a3f8723 100755 --- a/src/demos/j2d/TestTextureRenderer.java +++ b/src/demos/j2d/TestTextureRenderer.java @@ -57,7 +57,7 @@ import java.awt.font.GlyphVector; import java.text.DecimalFormat; import javax.media.opengl.GL; import javax.media.opengl.GLAutoDrawable; -import javax.media.nwi.NWCapabilities; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; @@ -74,7 +74,7 @@ public class TestTextureRenderer implements GLEventListener { public static void main(String[] args) { Frame frame = new Frame("Java 2D Renderer Test"); - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); caps.setAlphaBits(8); GLProfile.setProfile("GL2"); diff --git a/src/demos/jgears/JGears.java b/src/demos/jgears/JGears.java index 319931b..66c036d 100644 --- a/src/demos/jgears/JGears.java +++ b/src/demos/jgears/JGears.java @@ -18,7 +18,7 @@ import java.awt.image.BufferedImage; import java.io.InputStream; import java.text.DecimalFormat; import javax.imageio.ImageIO; -import javax.media.nwi.NWCapabilities; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.awt.GLJPanel; import com.sun.opengl.util.Animator; import javax.swing.JCheckBox; @@ -33,7 +33,7 @@ import javax.swing.JPanel; */ public class JGears extends GLJPanel { - private static NWCapabilities caps; + private static GLCapabilities caps; private long startTime; private int frameCount; private float fps; @@ -43,7 +43,7 @@ public class JGears extends GLJPanel { private BufferedImage openglImage; static { - caps = new NWCapabilities(); + caps = new GLCapabilities(); caps.setAlphaBits(8); } diff --git a/src/demos/jrefract/JRefract.java b/src/demos/jrefract/JRefract.java index 436bd30..d625b43 100755 --- a/src/demos/jrefract/JRefract.java +++ b/src/demos/jrefract/JRefract.java @@ -56,7 +56,7 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import javax.media.nwi.NWCapabilities; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.awt.GLJPanel; import com.sun.opengl.util.Animator; import com.sun.opengl.util.FPSAnimator; @@ -135,7 +135,7 @@ public class JRefract { inner.setClosable(true); inner.setVisible(true); - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); if (which == INFINITE) { caps.setStencilBits(16); } diff --git a/src/demos/misc/GLCapsTableDemo.java b/src/demos/misc/GLCapsTableDemo.java index 26599b4..44314fb 100755 --- a/src/demos/misc/GLCapsTableDemo.java +++ b/src/demos/misc/GLCapsTableDemo.java @@ -13,9 +13,10 @@ import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; -import javax.media.nwi.DefaultNWCapabilitiesChooser; -import javax.media.nwi.NWCapabilities; -import javax.media.nwi.NWCapabilitiesChooser; +import javax.media.nativewindow.Capabilities; +import javax.media.opengl.DefaultGLCapabilitiesChooser; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLCapabilitiesChooser; import javax.media.opengl.awt.GLCanvas; import com.sun.opengl.util.FPSAnimator; import javax.swing.BorderFactory; @@ -28,7 +29,7 @@ import javax.swing.JTable; /******************************************************************************* * @file GLCapsTableDemo.java - * @desc Demonstrate use of NWCapabilitiesChooser and DefaultNWCapabilities. + * @desc Demonstrate use of GLCapabilitiesChooser and DefaultGLCapabilities. * Demo tabulates the available capabilities array and put the data into a * table. Pressing respawn button displays a canvas created with the * currently selected index corresponding to the available array. There @@ -47,7 +48,7 @@ import javax.swing.JTable; public class GLCapsTableDemo extends JFrame implements - NWCapabilitiesChooser + GLCapabilitiesChooser { private String[] colNames = {"Pfd", "H/W", "DblBfr", "Stereo", // index, hwaccel, double, stereo @@ -55,7 +56,7 @@ public class GLCapsTableDemo "ABits", "aR", "aG", "aB", "aA", // accum bits "Z", "S", "AA|AAS", "PBuf(Float|RTT|RTTRec)"}; // depth, stencil, n // samples, pbuffer - private ArrayList/*<NWCapabilities>*/ available = new ArrayList/*<NWCapabilities>*/(); + private ArrayList/*<GLCapabilities>*/ available = new ArrayList/*<GLCapabilities>*/(); private ArrayList/*<Integer>*/ indices = new ArrayList/*<Integer>*/(); private Object[][] data; private JTable capsTable; @@ -63,18 +64,20 @@ public class GLCapsTableDemo private int selected = desiredCapIndex; protected JPanel pane, pane2; private boolean updateLR;// leftright - private DefaultNWCapabilitiesChooser choiceExaminer = // - new DefaultNWCapabilitiesChooser() + private DefaultGLCapabilitiesChooser choiceExaminer = // + new DefaultGLCapabilitiesChooser() { - public int chooseCapabilities(NWCapabilities desired, - NWCapabilities[] available, + public int chooseCapabilities(Capabilities _desired, + Capabilities[] _available, int windowSystemRecommendedChoice) { + GLCapabilities desired = (GLCapabilities) _desired; + GLCapabilities[] available = (GLCapabilities[]) _available; if ( available != null ) for (int i = 0; i < available.length; i++) { - NWCapabilities c = available[i]; + GLCapabilities c = available[i]; if (c != null) { - GLCapsTableDemo.this.available.add((NWCapabilities) c.clone()); + GLCapsTableDemo.this.available.add((GLCapabilities) c.clone()); GLCapsTableDemo.this.indices.add(new Integer(i)); } } @@ -109,7 +112,7 @@ public class GLCapsTableDemo private Dimension defdim = new Dimension(512, 256); private String visTip = "If no gears are visible, it may be that the " + "current desktop color resolution doesn't match " - + "the NWCapabilities chosen. Check CBits column."; + + "the GLCapabilities chosen. Check CBits column."; /** @@ -123,11 +126,11 @@ public class GLCapsTableDemo /** * (non-Javadoc) * - * @see javax.media.opengl.NWCapabilitiesChooser#chooseCapabilities(javax.media.opengl.NWCapabilities, - * javax.media.opengl.NWCapabilities[], int) + * @see javax.media.opengl.GLCapabilitiesChooser#chooseCapabilities(javax.media.nativewindow.Capabilities, + * javax.media.nativewindow.Capabilities[], int) */ - public int chooseCapabilities(NWCapabilities desired, - NWCapabilities[] available, + public int chooseCapabilities(Capabilities desired, + Capabilities[] available, int windowSystemRecommendedChoice) { int row = capsTable.getSelectedRow(); @@ -171,7 +174,7 @@ public class GLCapsTableDemo private void initComponents() { // Hack: use multisampled capabilities to pick up more detailed information on Windows - NWCapabilities multisampledCaps = new NWCapabilities(); + GLCapabilities multisampledCaps = new GLCapabilities(); multisampledCaps.setSampleBuffers(true); canvas = new GLCanvas(multisampledCaps, choiceExaminer, null, device); @@ -201,7 +204,7 @@ public class GLCapsTableDemo getContentPane().add(buildControls(), BorderLayout.NORTH); } - private JTable tabulateTable(ArrayList/*<NWCapabilities>*/ capabilities, + private JTable tabulateTable(ArrayList/*<GLCapabilities>*/ capabilities, ArrayList/*<Integer>*/ indices) { capabilities.trimToSize(); @@ -210,7 +213,7 @@ public class GLCapsTableDemo for (int pfd = 0; pfd < capabilities.size(); pfd++) { data[ pfd ][ 0 ] = indices.get(pfd); - NWCapabilities cap = (NWCapabilities) capabilities.get(pfd); + GLCapabilities cap = (GLCapabilities) capabilities.get(pfd); data[ pfd ][ 1 ] = "" + (cap.getHardwareAccelerated() ? f : f); data[ pfd ][ 2 ] = "" + (cap.getDoubleBuffered() ? t : f); data[ pfd ][ 3 ] = "" + (cap.getStereo() ? t : f); diff --git a/src/demos/misc/Picking.java b/src/demos/misc/Picking.java index 1c05178..6f95251 100755 --- a/src/demos/misc/Picking.java +++ b/src/demos/misc/Picking.java @@ -14,7 +14,6 @@ import java.awt.*; import java.awt.event.*; import java.awt.Canvas.*; import java.nio.*; -import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.glu.*; @@ -32,7 +31,7 @@ public class Picking { Frame frame = new Frame("Picking Example"); GLDrawableFactory factory = GLDrawableFactory.getFactory(); - NWCapabilities capabilities = new NWCapabilities(); + GLCapabilities capabilities = new GLCapabilities(); GLCanvas drawable = new GLCanvas(capabilities); final Renderer renderer = new Renderer(); drawable.addGLEventListener(renderer); diff --git a/src/demos/misc/TiledRendering.java b/src/demos/misc/TiledRendering.java index db3b8e9..b218b01 100755 --- a/src/demos/misc/TiledRendering.java +++ b/src/demos/misc/TiledRendering.java @@ -15,7 +15,7 @@ import javax.imageio.ImageIO; import javax.media.opengl.GL; import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2; -import javax.media.nwi.NWCapabilities; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLPbuffer; @@ -44,7 +44,7 @@ public class TiledRendering { } // Use a pbuffer for rendering - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); caps.setDoubleBuffered(false); GLPbuffer pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(caps, null, 256, 256, diff --git a/src/demos/multisample/Multisample.java b/src/demos/multisample/Multisample.java index 91f57c3..ee80d5e 100755 --- a/src/demos/multisample/Multisample.java +++ b/src/demos/multisample/Multisample.java @@ -41,7 +41,6 @@ package demos.multisample; import java.awt.*; import java.awt.event.*; -import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.awt.GLCanvas; @@ -49,13 +48,13 @@ public class Multisample { private GLCanvas canvas; // Simple class to warn if results are not going to be as expected - static class MultisampleChooser extends DefaultNWCapabilitiesChooser { - public int chooseCapabilities(NWCapabilities desired, - NWCapabilities[] available, + static class MultisampleChooser extends DefaultGLCapabilitiesChooser { + public int chooseCapabilities(GLCapabilities desired, + GLCapabilities[] available, int windowSystemRecommendedChoice) { boolean anyHaveSampleBuffers = false; for (int i = 0; i < available.length; i++) { - NWCapabilities caps = available[i]; + GLCapabilities caps = available[i]; if (caps != null && caps.getSampleBuffers()) { anyHaveSampleBuffers = true; break; @@ -66,7 +65,7 @@ public class Multisample { System.err.println("WARNING: antialiasing will be disabled because none of the available pixel formats had it to offer"); } else { if (!available[selection].getSampleBuffers()) { - System.err.println("WARNING: antialiasing will be disabled because the DefaultNWCapabilitiesChooser didn't supply it"); + System.err.println("WARNING: antialiasing will be disabled because the DefaultGLCapabilitiesChooser didn't supply it"); } } return selection; @@ -78,8 +77,8 @@ public class Multisample { } public void run(String[] args) { - NWCapabilities caps = new NWCapabilities(); - NWCapabilitiesChooser chooser = new MultisampleChooser(); + GLCapabilities caps = new GLCapabilities(); + GLCapabilitiesChooser chooser = new MultisampleChooser(); caps.setSampleBuffers(true); caps.setNumSamples(4); diff --git a/src/demos/particles/engine/GLComponent.java b/src/demos/particles/engine/GLComponent.java index 1b56f85..f64953d 100755 --- a/src/demos/particles/engine/GLComponent.java +++ b/src/demos/particles/engine/GLComponent.java @@ -36,7 +36,6 @@ package demos.particles.engine; -import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; import javax.media.opengl.awt.*; @@ -63,8 +62,8 @@ public class GLComponent extends GLCanvas implements GLEventListener { animator = new FPSAnimator(this, fps); } - private static NWCapabilities getCapabilities() { - NWCapabilities caps = new NWCapabilities(); + private static GLCapabilities getCapabilities() { + GLCapabilities caps = new GLCapabilities(); caps.setDoubleBuffered(true); caps.setHardwareAccelerated(true); return caps; diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java index 8304b6a..3771368 100644 --- a/src/demos/proceduralTexturePhysics/Water.java +++ b/src/demos/proceduralTexturePhysics/Water.java @@ -49,7 +49,7 @@ import javax.media.opengl.GL; import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; -import javax.media.nwi.NWCapabilities; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLException; @@ -213,7 +213,7 @@ public class Water { // create the pbuffer. Will use this as an offscreen rendering buffer. // it allows rendering a texture larger than our window. - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); caps.setDoubleBuffered(false); if (!GLDrawableFactory.getFactory().canCreateGLPbuffer()) { throw new GLException("Pbuffers not supported with this graphics card"); diff --git a/src/demos/texture/TextureConvert.java b/src/demos/texture/TextureConvert.java index 55f2f0a..13180fc 100755 --- a/src/demos/texture/TextureConvert.java +++ b/src/demos/texture/TextureConvert.java @@ -46,7 +46,7 @@ import com.sun.opengl.util.texture.TextureIO; import java.io.File; import java.io.IOException; import javax.media.opengl.GL; -import javax.media.nwi.NWCapabilities; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLPbuffer; @@ -74,7 +74,7 @@ public class TextureConvert { System.out.println("Pbuffer support not available (required to run this demo)"); System.exit(1); } - NWCapabilities caps = new NWCapabilities(); + GLCapabilities caps = new GLCapabilities(); caps.setDoubleBuffered(false); GLPbuffer pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(caps, null, 2, 2, null); pbuffer.getContext().makeCurrent(); |