diff options
author | Sven Gothel <[email protected]> | 2009-03-13 12:10:29 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-03-13 12:10:29 +0000 |
commit | 8417ded5c1f892b58a4608ff248842c8aed4026a (patch) | |
tree | f9ce74136307bd122c72cec3babd03c26052e9df /src/demos | |
parent | e03aaaf1b14cc40cb2c8f2158acf02390c4fafe6 (diff) |
Adapt to JOGL nwi package changes
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@320 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos')
30 files changed, 102 insertions, 75 deletions
diff --git a/src/demos/GLInfo.java b/src/demos/GLInfo.java index 02b3fa4..70fcb91 100755 --- a/src/demos/GLInfo.java +++ b/src/demos/GLInfo.java @@ -1,6 +1,7 @@ package demos; import java.nio.*; +import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.util.*; import javax.media.opengl.glu.*; @@ -17,13 +18,13 @@ public class GLInfo implements GLEventListener { System.err.println("GLInfo.run()"); GLProfile.setProfileGLAny(); try { - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); caps.setBlueBits(5); caps.setDepthBits(16); - System.err.println("GLCapabilities PRE : "+caps); + System.err.println("NWCapabilities PRE : "+caps); Window nWindow = null; if(0!=(type&USE_AWT)) { @@ -38,7 +39,7 @@ public class GLInfo implements GLEventListener { // Size OpenGL to Video Surface window.setSize(width, height); - window.setFullscreen(true); + // window.setFullscreen(true); window.setVisible(true); window.display(); @@ -55,7 +56,7 @@ public class GLInfo implements GLEventListener { public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); - System.err.println("GLCapabilities POST: "+drawable.getChosenGLCapabilities()); + System.err.println("NWCapabilities POST: "+drawable.getChosenNWCapabilities()); 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 3a24579..b75e289 100755 --- a/src/demos/context/DualContext.java +++ b/src/demos/context/DualContext.java @@ -46,6 +46,7 @@ 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.opengl.*; import javax.media.opengl.awt.*; import javax.media.opengl.glu.GLU; @@ -69,7 +70,7 @@ public class DualContext extends Canvas { private GLUT glut; private int repaintNum; - public DualContext(GLCapabilities capabilities) { + public DualContext(NWCapabilities capabilities) { super(unwrap((AWTGraphicsConfiguration) NativeWindowFactory.getFactory(Canvas.class).chooseGraphicsConfiguration(capabilities, null, null))); NativeWindow win = NativeWindowFactory.getFactory(getClass()).getNativeWindow(this); @@ -139,7 +140,7 @@ 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 GLCapabilities()); + final DualContext dc = new DualContext(new NWCapabilities()); 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 34a7e0c..0756005 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.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; 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) { - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); GLCanvas canvas = new GLCanvas(caps); FBCubes cubes = new FBCubes(); diff --git a/src/demos/es1/Info.java b/src/demos/es1/Info.java index 527c6f1..4c7d667 100755 --- a/src/demos/es1/Info.java +++ b/src/demos/es1/Info.java @@ -1,6 +1,7 @@ package demos.es1; import java.nio.*; +import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.util.*; import javax.media.opengl.glu.*; @@ -17,7 +18,7 @@ public class Info implements GLEventListener { System.err.println("Info.run()"); GLProfile.setProfileGL2ES1(); try { - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); // 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 04ea334..56a367a 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -1,6 +1,7 @@ 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.*; @@ -10,12 +11,22 @@ import com.sun.opengl.impl.fixed.GLFixedFuncImpl; import com.sun.javafx.newt.*; -public class RedSquare implements MouseListener, GLEventListener { +public class RedSquare implements KeyListener, MouseListener, GLEventListener { private GLWindow window; private GLU glu; private boolean quit = false; + public void keyPressed(KeyEvent e) { + System.out.println(e); + } + public void keyReleased(KeyEvent e) { + System.out.println(e); + } + public void keyTyped(KeyEvent e) { + System.out.println(e); + } + public void mouseClicked(MouseEvent e) { System.out.println("mouseevent: "+e); switch(e.getClickCount()) { @@ -46,7 +57,7 @@ public class RedSquare implements MouseListener, GLEventListener { System.err.println("RedSquare.run()"); GLProfile.setProfileGLAny(); try { - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); @@ -62,6 +73,7 @@ public class RedSquare implements MouseListener, GLEventListener { window = GLWindow.create(nWindow, caps); window.addMouseListener(this); + window.addKeyListener(this); window.addGLEventListener(this); // window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_CURRENT); // default // window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_NONE); // no current .. @@ -69,7 +81,7 @@ public class RedSquare implements MouseListener, GLEventListener { window.enablePerfLog(true); // Size OpenGL to Video Surface window.setSize(width, height); - window.setFullscreen(true); + // window.setFullscreen(true); window.setVisible(true); while (!quit && window.getDuration() < 20000) { diff --git a/src/demos/es1/angeles/Main.java b/src/demos/es1/angeles/Main.java index 5833c7c..4983619 100755 --- a/src/demos/es1/angeles/Main.java +++ b/src/demos/es1/angeles/Main.java @@ -1,6 +1,7 @@ package demos.es1.angeles; import java.nio.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.javafx.newt.*; @@ -35,7 +36,7 @@ public class Main implements MouseListener { GLProfile.setProfileGLAny(); try { // Hook this into EGL - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); // 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 63bea14..1ef6aab 100644 --- a/src/demos/es1/cube/Cube.java +++ b/src/demos/es1/cube/Cube.java @@ -32,6 +32,7 @@ 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.*; @@ -308,7 +309,7 @@ public class Cube implements GLEventListener { System.err.println("Cube.run()"); GLProfile.setProfileGLAny(); try { - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); // 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 c85fed0..c7536d2 100644 --- a/src/demos/es1/cube/CubeImmModeSink.java +++ b/src/demos/es1/cube/CubeImmModeSink.java @@ -31,6 +31,7 @@ */ package demos.es1.cube; +import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; @@ -399,7 +400,7 @@ public class CubeImmModeSink implements GLEventListener { System.err.println("CubeImmModeSink.run()"); GLProfile.setProfileGLAny(); try { - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); // 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 c9abaf2..f245733 100755 --- a/src/demos/es1/cubefbo/Main.java +++ b/src/demos/es1/cubefbo/Main.java @@ -1,6 +1,7 @@ package demos.es1.cubefbo; import java.nio.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.javafx.newt.*; @@ -41,7 +42,7 @@ public class Main implements MouseListener { GLProfile.setProfileGLAny(); try { // Hook this into EGL - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); // 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 2cda004..de7563e 100755 --- a/src/demos/es2/RedSquare.java +++ b/src/demos/es2/RedSquare.java @@ -1,6 +1,7 @@ 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.*; @@ -48,7 +49,7 @@ public class RedSquare implements MouseListener, GLEventListener { System.err.println("RedSquare.run()"); GLProfile.setProfileGL2ES2(); try { - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); // 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 52b347c..1e194bc 100644 --- a/src/demos/es2/openmax/Cube.java +++ b/src/demos/es2/openmax/Cube.java @@ -31,6 +31,7 @@ */ package demos.es2.openmax; +import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; @@ -327,7 +328,7 @@ public class Cube implements GLEventListener { System.err.println("Cube.run()"); GLProfile.setProfileGLAny(); try { - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); // 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 e52783f..1c98f70 100755 --- a/src/demos/es2/openmax/MovieCube.java +++ b/src/demos/es2/openmax/MovieCube.java @@ -35,6 +35,7 @@ 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 +89,7 @@ public class MovieCube implements MouseListener, GLEventListener, OMXEventListen System.err.println("MovieCube.run()"); GLProfile.setProfileGL2ES2(); try { - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); // 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 b93d325..a58156b 100755 --- a/src/demos/es2/openmax/MovieSimple.java +++ b/src/demos/es2/openmax/MovieSimple.java @@ -34,6 +34,7 @@ package demos.es2.openmax; +import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.util.*; @@ -93,7 +94,7 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList System.err.println("MovieSimple.run()"); GLProfile.setProfileGL2ES2(); try { - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); // 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 ee1924e..d67f827 100755 --- a/src/demos/es2/perftst/Perftst.java +++ b/src/demos/es2/perftst/Perftst.java @@ -1,6 +1,7 @@ package demos.es2.perftst; import java.nio.*; +import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.util.*; @@ -43,7 +44,7 @@ public class Perftst implements MouseListener, GLEventListener { System.err.println("Perftst.run()"); GLProfile.setProfileGL2ES2(); try { - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); // For emulation library, use 16 bpp caps.setRedBits(5); caps.setGreenBits(6); diff --git a/src/demos/gears/Gears.java b/src/demos/gears/Gears.java index feef5a5..ba02ef4 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 GLCapabilities: " + drawable.getChosenGLCapabilities()); + System.err.println("Chosen NWCapabilities: " + drawable.getChosenNWCapabilities()); gl.setSwapInterval(1); diff --git a/src/demos/hdr/HDR.java b/src/demos/hdr/HDR.java index d86b2ff..5aedd53 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.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; 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; - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); caps.setDoubleBuffered(false); caps.setPbufferFloatingPointBuffers(true); caps.setRedBits(floatBits); diff --git a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java index 71dd982..f287053 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.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; 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 - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); caps.setDoubleBuffered(false); if (!GLDrawableFactory.getFactory().canCreateGLPbuffer()) { diff --git a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java index b2a2284..9e648d3 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.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; 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) { - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); 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 6c85610..a5a6fa6 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"); - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); 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 915dfd2..035f3fd 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.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; 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"); - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); 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 bedcd8c..79cfd44 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.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; 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"); - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); caps.setAlphaBits(8); GLProfile.setProfile("GL2"); diff --git a/src/demos/jgears/JGears.java b/src/demos/jgears/JGears.java index 66c036d..319931b 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.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; 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 GLCapabilities caps; + private static NWCapabilities 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 GLCapabilities(); + caps = new NWCapabilities(); caps.setAlphaBits(8); } diff --git a/src/demos/jrefract/JRefract.java b/src/demos/jrefract/JRefract.java index d625b43..436bd30 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.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; 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); - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); if (which == INFINITE) { caps.setStencilBits(16); } diff --git a/src/demos/misc/GLCapsTableDemo.java b/src/demos/misc/GLCapsTableDemo.java index edeb28b..26599b4 100755 --- a/src/demos/misc/GLCapsTableDemo.java +++ b/src/demos/misc/GLCapsTableDemo.java @@ -13,9 +13,9 @@ import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; -import javax.media.opengl.DefaultGLCapabilitiesChooser; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; +import javax.media.nwi.DefaultNWCapabilitiesChooser; +import javax.media.nwi.NWCapabilities; +import javax.media.nwi.NWCapabilitiesChooser; import javax.media.opengl.awt.GLCanvas; import com.sun.opengl.util.FPSAnimator; import javax.swing.BorderFactory; @@ -28,7 +28,7 @@ import javax.swing.JTable; /******************************************************************************* * @file GLCapsTableDemo.java - * @desc Demonstrate use of GLCapabilitiesChooser and DefaultGLCapabilities. + * @desc Demonstrate use of NWCapabilitiesChooser and DefaultNWCapabilities. * 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 +47,7 @@ import javax.swing.JTable; public class GLCapsTableDemo extends JFrame implements - GLCapabilitiesChooser + NWCapabilitiesChooser { private String[] colNames = {"Pfd", "H/W", "DblBfr", "Stereo", // index, hwaccel, double, stereo @@ -55,7 +55,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/*<GLCapabilities>*/ available = new ArrayList/*<GLCapabilities>*/(); + private ArrayList/*<NWCapabilities>*/ available = new ArrayList/*<NWCapabilities>*/(); private ArrayList/*<Integer>*/ indices = new ArrayList/*<Integer>*/(); private Object[][] data; private JTable capsTable; @@ -63,18 +63,18 @@ public class GLCapsTableDemo private int selected = desiredCapIndex; protected JPanel pane, pane2; private boolean updateLR;// leftright - private DefaultGLCapabilitiesChooser choiceExaminer = // - new DefaultGLCapabilitiesChooser() + private DefaultNWCapabilitiesChooser choiceExaminer = // + new DefaultNWCapabilitiesChooser() { - public int chooseCapabilities(GLCapabilities desired, - GLCapabilities[] available, + public int chooseCapabilities(NWCapabilities desired, + NWCapabilities[] available, int windowSystemRecommendedChoice) { if ( available != null ) for (int i = 0; i < available.length; i++) { - GLCapabilities c = available[i]; + NWCapabilities c = available[i]; if (c != null) { - GLCapsTableDemo.this.available.add((GLCapabilities) c.clone()); + GLCapsTableDemo.this.available.add((NWCapabilities) c.clone()); GLCapsTableDemo.this.indices.add(new Integer(i)); } } @@ -109,7 +109,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 GLCapabilities chosen. Check CBits column."; + + "the NWCapabilities chosen. Check CBits column."; /** @@ -123,11 +123,11 @@ public class GLCapsTableDemo /** * (non-Javadoc) * - * @see javax.media.opengl.GLCapabilitiesChooser#chooseCapabilities(javax.media.opengl.GLCapabilities, - * javax.media.opengl.GLCapabilities[], int) + * @see javax.media.opengl.NWCapabilitiesChooser#chooseCapabilities(javax.media.opengl.NWCapabilities, + * javax.media.opengl.NWCapabilities[], int) */ - public int chooseCapabilities(GLCapabilities desired, - GLCapabilities[] available, + public int chooseCapabilities(NWCapabilities desired, + NWCapabilities[] available, int windowSystemRecommendedChoice) { int row = capsTable.getSelectedRow(); @@ -171,7 +171,7 @@ public class GLCapsTableDemo private void initComponents() { // Hack: use multisampled capabilities to pick up more detailed information on Windows - GLCapabilities multisampledCaps = new GLCapabilities(); + NWCapabilities multisampledCaps = new NWCapabilities(); multisampledCaps.setSampleBuffers(true); canvas = new GLCanvas(multisampledCaps, choiceExaminer, null, device); @@ -201,7 +201,7 @@ public class GLCapsTableDemo getContentPane().add(buildControls(), BorderLayout.NORTH); } - private JTable tabulateTable(ArrayList/*<GLCapabilities>*/ capabilities, + private JTable tabulateTable(ArrayList/*<NWCapabilities>*/ capabilities, ArrayList/*<Integer>*/ indices) { capabilities.trimToSize(); @@ -210,7 +210,7 @@ public class GLCapsTableDemo for (int pfd = 0; pfd < capabilities.size(); pfd++) { data[ pfd ][ 0 ] = indices.get(pfd); - GLCapabilities cap = (GLCapabilities) capabilities.get(pfd); + NWCapabilities cap = (NWCapabilities) 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 1fd3963..9d50284 100755 --- a/src/demos/misc/Picking.java +++ b/src/demos/misc/Picking.java @@ -14,6 +14,7 @@ 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.*; @@ -31,7 +32,7 @@ public class Picking { Frame frame = new Frame("Picking Example"); GLDrawableFactory factory = GLDrawableFactory.getFactory(); - GLCapabilities capabilities = new GLCapabilities(); + NWCapabilities capabilities = new NWCapabilities(); 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 b218b01..db3b8e9 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.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; 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 - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); 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 ed72d00..2fb76b3 100755 --- a/src/demos/multisample/Multisample.java +++ b/src/demos/multisample/Multisample.java @@ -41,6 +41,7 @@ package demos.multisample; import java.awt.*; import java.awt.event.*; +import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.awt.GLCanvas; @@ -48,13 +49,13 @@ public class Multisample { private GLCanvas canvas; // Simple class to warn if results are not going to be as expected - static class MultisampleChooser extends DefaultGLCapabilitiesChooser { - public int chooseCapabilities(GLCapabilities desired, - GLCapabilities[] available, + static class MultisampleChooser extends DefaultNWCapabilitiesChooser { + public int chooseCapabilities(NWCapabilities desired, + NWCapabilities[] available, int windowSystemRecommendedChoice) { boolean anyHaveSampleBuffers = false; for (int i = 0; i < available.length; i++) { - GLCapabilities caps = available[i]; + NWCapabilities caps = available[i]; if (caps != null && caps.getSampleBuffers()) { anyHaveSampleBuffers = true; break; @@ -65,7 +66,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 DefaultGLCapabilitiesChooser didn't supply it"); + System.err.println("WARNING: antialiasing will be disabled because the DefaultNWCapabilitiesChooser didn't supply it"); } } return selection; @@ -77,8 +78,8 @@ public class Multisample { } public void run(String[] args) { - GLCapabilities caps = new GLCapabilities(); - GLCapabilitiesChooser chooser = new MultisampleChooser(); + NWCapabilities caps = new NWCapabilities(); + NWCapabilitiesChooser 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 b28fcf2..52bf6af 100755 --- a/src/demos/particles/engine/GLComponent.java +++ b/src/demos/particles/engine/GLComponent.java @@ -36,6 +36,7 @@ package demos.particles.engine; +import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; import javax.media.opengl.awt.*; @@ -62,8 +63,8 @@ public class GLComponent extends GLCanvas implements GLEventListener { animator = new FPSAnimator(this, fps); } - private static GLCapabilities getCapabilities() { - GLCapabilities caps = new GLCapabilities(); + private static NWCapabilities getCapabilities() { + NWCapabilities caps = new NWCapabilities(); caps.setDoubleBuffered(true); caps.setHardwareAccelerated(true); return caps; diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java index 5495e44..cf3287a 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.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; 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. - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); 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 13180fc..55f2f0a 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.opengl.GLCapabilities; +import javax.media.nwi.NWCapabilities; 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); } - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); caps.setDoubleBuffered(false); GLPbuffer pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(caps, null, 2, 2, null); pbuffer.getContext().makeCurrent(); |