diff options
author | Sven Gothel <[email protected]> | 2009-05-29 02:06:27 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-05-29 02:06:27 +0000 |
commit | 79466d482c8dd58907c9c414b851e4895c06d6cc (patch) | |
tree | c91b68d3482ce341e62182ae3d774fc236f50339 | |
parent | 92bf955f17d1c070322ccf94d2de76d74f3eaa40 (diff) |
GLInfo gives some usefull info, fix with GL3 changes
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@336 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
-rwxr-xr-x | src/demos/GLInfo.java | 32 | ||||
-rwxr-xr-x | src/demos/context/DualContext.java | 16 | ||||
-rwxr-xr-x | src/demos/es1/Info.java | 7 | ||||
-rwxr-xr-x | src/demos/es1/RedSquare.java | 7 | ||||
-rwxr-xr-x | src/demos/es1/angeles/Main.java | 7 | ||||
-rw-r--r-- | src/demos/es1/cube/Cube.java | 7 | ||||
-rw-r--r-- | src/demos/es1/cube/CubeImmModeSink.java | 7 | ||||
-rwxr-xr-x | src/demos/es1/cubefbo/Main.java | 7 | ||||
-rwxr-xr-x | src/demos/es2/RedSquare.java | 7 | ||||
-rw-r--r-- | src/demos/es2/openmax/Cube.java | 7 | ||||
-rwxr-xr-x | src/demos/es2/perftst/Perftst.java | 7 | ||||
-rw-r--r-- | src/jbullet/src/javabullet/demos/opengl/JOGL.java | 8 |
12 files changed, 76 insertions, 43 deletions
diff --git a/src/demos/GLInfo.java b/src/demos/GLInfo.java index d17ad28..a5a0a91 100755 --- a/src/demos/GLInfo.java +++ b/src/demos/GLInfo.java @@ -3,6 +3,7 @@ package demos; import java.nio.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; +import javax.media.nativewindow.*; import com.sun.javafx.newt.*; import com.sun.javafx.newt.opengl.*; @@ -12,10 +13,14 @@ public class GLInfo implements GLEventListener { private GLWindow window; private void run(int type) { - int width = 10; - int height = 10; + int width = 256; + int height = 256; System.err.println("GLInfo.run()"); - GLProfile.setProfileGLAny(); + if(null==glprofile) { + GLProfile.setProfileGLAny(); + } else { + GLProfile.setProfile(glprofile); + } try { GLCapabilities caps = new GLCapabilities(); // For emulation library, use 16 bpp @@ -27,9 +32,10 @@ public class GLInfo implements GLEventListener { Window nWindow = null; if(0!=(type&USE_AWT)) { - Display nDisplay = NewtFactory.createDisplay(NewtFactory.AWT, null); // local display - Screen nScreen = NewtFactory.createScreen(NewtFactory.AWT, nDisplay, 0); // screen 0 - nWindow = NewtFactory.createWindow(NewtFactory.AWT, nScreen, caps); + Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display + Screen nScreen = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0 + nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps); + System.err.println(nWindow); //nWindow.setVisible(true); } window = GLWindow.create(nWindow, caps); @@ -67,9 +73,19 @@ public class GLInfo implements GLEventListener { System.err.println(" Fixed: glBegin: "+gl.isFunctionAvailable("glBegin")); System.err.println(" ES1 : glClearColorx: "+gl.isFunctionAvailable("glClearColorx")); System.err.println(" GLSL : glUseProgram: "+gl.isFunctionAvailable("glUseProgram")); + System.err.println(" GL_ARB_vertex_array_object: "+gl.isExtensionAvailable("GL_ARB_vertex_array_object")); + System.err.println(" GL_ARB_vertex_array_object: glBindVertexArray: "+gl.isFunctionAvailable("glBindVertexArray")); + System.err.println(" GL_EXT_gpu_shader4: "+gl.isExtensionAvailable("GL_EXT_gpu_shader4")); + System.err.println(" GL_EXT_gpu_shader4: glBindFragDataLocation"+gl.isFunctionAvailable("glBindFragDataLocation")); + System.err.println(" GL_VERSION_3_0: "+gl.isExtensionAvailable("GL_VERSION_3_0")); + System.err.println(" GL_VERSION_3_0: glBeginConditionalRender: "+gl.isFunctionAvailable("glBeginConditionalRender")); + System.err.println(" GL_ARB_texture_buffer_object: "+gl.isExtensionAvailable("GL_ARB_texture_buffer_object")); + System.err.println(" GL_ARB_texture_buffer_object: glTexBuffer: "+gl.isFunctionAvailable("glTexBuffer")); + System.err.println(" GL_VERSION_3_1: "+gl.isExtensionAvailable("GL_VERSION_3_1")); System.err.println(" EGL : eglCreateContext: "+gl.isFunctionAvailable("eglCreateContext")); System.err.println(" EGLEx: eglCreateImage: "+gl.isFunctionAvailable("eglCreateImage")); System.err.println(" GLX : glXCreateWindow: "+gl.isFunctionAvailable("glXCreateWindow")); + System.err.println(" GLX_ARB_create_context: "+gl.isExtensionAvailable("GLX_ARB_create_context")); System.err.println(" WGL : wglCreateContext: "+gl.isFunctionAvailable("wglCreateContext")); System.err.println(" CGL : CGLCreateContext: "+gl.isFunctionAvailable("CGLCreateContext")); } @@ -88,6 +104,7 @@ public class GLInfo implements GLEventListener { public static int USE_NEWT = 0; public static int USE_AWT = 1 << 0; + public static String glprofile = null; public static void main(String[] args) { int type = USE_NEWT ; @@ -95,6 +112,9 @@ public class GLInfo implements GLEventListener { if(args[i].equals("-awt")) { type |= USE_AWT; } + if(args[i].startsWith("-GL")) { + glprofile=args[i].substring(1); + } } new GLInfo().run(type); System.exit(0); diff --git a/src/demos/context/DualContext.java b/src/demos/context/DualContext.java index 30e36b4..be174bb 100755 --- a/src/demos/context/DualContext.java +++ b/src/demos/context/DualContext.java @@ -71,11 +71,10 @@ public class DualContext extends Canvas { private GLUT glut; private int repaintNum; - public DualContext(GLCapabilities capabilities) { - super(unwrap((AWTGraphicsConfiguration) - GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(capabilities, null, null))); - NativeWindow win = NativeWindowFactory.getFactory(getClass()).getNativeWindow(this); - drawable = GLDrawableFactory.getFactory().createGLDrawable(win, capabilities, null); + public DualContext(AWTGraphicsConfiguration config) { + super(unwrap(config)); + NativeWindow win = NativeWindowFactory.getFactory(getClass()).getNativeWindow(this, config); + drawable = GLDrawableFactory.getFactory().createGLDrawable(win); context1 = drawable.createContext(null); context2 = drawable.createContext(null); glu = new GLU(); @@ -143,7 +142,12 @@ public class DualContext extends Canvas { JFrame frame = new JFrame("Dual OpenGL Context Test"); // Get the GraphicsConfigurationFactory ready for OpenGL work GLDrawableFactory.getFactory(); - final DualContext dc = new DualContext(new GLCapabilities()); + + AWTGraphicsScreen screen = (AWTGraphicsScreen)AWTGraphicsScreen.createDefault(); + AWTGraphicsConfiguration config = (AWTGraphicsConfiguration) + GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(new GLCapabilities(), null, screen); + final DualContext dc = new DualContext(config); + frame.getContentPane().add(dc, BorderLayout.CENTER); JButton button = new JButton("Repaint"); button.addActionListener(new ActionListener() { diff --git a/src/demos/es1/Info.java b/src/demos/es1/Info.java index d26738f..de3d16d 100755 --- a/src/demos/es1/Info.java +++ b/src/demos/es1/Info.java @@ -3,6 +3,7 @@ package demos.es1; import java.nio.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; +import javax.media.nativewindow.*; import com.sun.javafx.newt.*; import com.sun.javafx.newt.opengl.*; @@ -26,9 +27,9 @@ public class Info implements GLEventListener { Window nWindow = null; if(0!=(type&USE_AWT)) { - Display nDisplay = NewtFactory.createDisplay(NewtFactory.AWT, null); // local display - Screen nScreen = NewtFactory.createScreen(NewtFactory.AWT, nDisplay, 0); // screen 0 - nWindow = NewtFactory.createWindow(NewtFactory.AWT, nScreen, caps); + Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display + Screen nScreen = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0 + nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps); } window = GLWindow.create(nWindow, caps); diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index fc134db..2948f42 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -3,6 +3,7 @@ package demos.es1; import java.nio.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; +import javax.media.nativewindow.*; import com.sun.opengl.util.*; import com.sun.opengl.util.glsl.fixedfunc.*; @@ -79,9 +80,9 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL Window nWindow = null; if(0!=(type&USE_AWT)) { - Display nDisplay = NewtFactory.createDisplay(NewtFactory.AWT, null); // local display - Screen nScreen = NewtFactory.createScreen(NewtFactory.AWT, nDisplay, 0); // screen 0 - nWindow = NewtFactory.createWindow(NewtFactory.AWT, nScreen, caps); + Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display + Screen nScreen = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0 + nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps); } window = GLWindow.create(nWindow, caps); diff --git a/src/demos/es1/angeles/Main.java b/src/demos/es1/angeles/Main.java index 226f595..3346a1f 100755 --- a/src/demos/es1/angeles/Main.java +++ b/src/demos/es1/angeles/Main.java @@ -2,6 +2,7 @@ package demos.es1.angeles; import java.nio.*; import javax.media.opengl.*; +import javax.media.nativewindow.*; import com.sun.javafx.newt.*; import com.sun.javafx.newt.opengl.*; @@ -61,9 +62,9 @@ public class Main implements WindowListener, MouseListener { Window nWindow = null; if(0!=(type&USE_AWT)) { - Display nDisplay = NewtFactory.createDisplay(NewtFactory.AWT, null); // local display - Screen nScreen = NewtFactory.createScreen(NewtFactory.AWT, nDisplay, 0); // screen 0 - nWindow = NewtFactory.createWindow(NewtFactory.AWT, nScreen, caps); + Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display + Screen nScreen = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0 + nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps); } window = GLWindow.create(nWindow, caps); diff --git a/src/demos/es1/cube/Cube.java b/src/demos/es1/cube/Cube.java index 1d31527..3a8a22e 100644 --- a/src/demos/es1/cube/Cube.java +++ b/src/demos/es1/cube/Cube.java @@ -34,6 +34,7 @@ package demos.es1.cube; import java.nio.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; +import javax.media.nativewindow.*; import com.sun.opengl.util.*; import com.sun.opengl.util.glsl.fixedfunc.*; @@ -302,9 +303,9 @@ public class Cube implements GLEventListener { Window nWindow = null; if(0!=(type&USE_AWT)) { - Display nDisplay = NewtFactory.createDisplay(NewtFactory.AWT, null); // local display - Screen nScreen = NewtFactory.createScreen(NewtFactory.AWT, nDisplay, 0); // screen 0 - nWindow = NewtFactory.createWindow(NewtFactory.AWT, nScreen, caps); + Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display + Screen nScreen = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0 + nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps); } GLWindow window = GLWindow.create(nWindow, caps); diff --git a/src/demos/es1/cube/CubeImmModeSink.java b/src/demos/es1/cube/CubeImmModeSink.java index 69504fe..dcc0487 100644 --- a/src/demos/es1/cube/CubeImmModeSink.java +++ b/src/demos/es1/cube/CubeImmModeSink.java @@ -33,6 +33,7 @@ package demos.es1.cube; import javax.media.opengl.*; import javax.media.opengl.glu.*; +import javax.media.nativewindow.*; import com.sun.opengl.util.*; import com.sun.opengl.util.glsl.fixedfunc.*; import java.nio.*; @@ -390,9 +391,9 @@ public class CubeImmModeSink implements GLEventListener { Window nWindow = null; if(0!=(type&USE_AWT)) { - Display nDisplay = NewtFactory.createDisplay(NewtFactory.AWT, null); // local display - Screen nScreen = NewtFactory.createScreen(NewtFactory.AWT, nDisplay, 0); // screen 0 - nWindow = NewtFactory.createWindow(NewtFactory.AWT, nScreen, caps); + Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display + Screen nScreen = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0 + nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps); } GLWindow window = GLWindow.create(nWindow, caps); diff --git a/src/demos/es1/cubefbo/Main.java b/src/demos/es1/cubefbo/Main.java index b80e1af..1cb0bdc 100755 --- a/src/demos/es1/cubefbo/Main.java +++ b/src/demos/es1/cubefbo/Main.java @@ -2,6 +2,7 @@ package demos.es1.cubefbo; import java.nio.*; import javax.media.opengl.*; +import javax.media.nativewindow.*; import com.sun.javafx.newt.*; import com.sun.javafx.newt.opengl.*; @@ -62,9 +63,9 @@ public class Main implements WindowListener, MouseListener { Window nWindow = null; if(0!=(type&USE_AWT)) { - Display nDisplay = NewtFactory.createDisplay(NewtFactory.AWT, null); // local display - Screen nScreen = NewtFactory.createScreen(NewtFactory.AWT, nDisplay, 0); // screen 0 - nWindow = NewtFactory.createWindow(NewtFactory.AWT, nScreen, caps); + Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display + Screen nScreen = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0 + nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps); } window = GLWindow.create(nWindow, caps); diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java index ba4c307..822a85c 100755 --- a/src/demos/es2/RedSquare.java +++ b/src/demos/es2/RedSquare.java @@ -3,6 +3,7 @@ package demos.es2; import java.nio.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; +import javax.media.nativewindow.*; import com.sun.opengl.util.*; import com.sun.opengl.util.glsl.*; @@ -59,9 +60,9 @@ public class RedSquare implements MouseListener, GLEventListener { Window nWindow = null; if(0!=(type&USE_AWT)) { - Display nDisplay = NewtFactory.createDisplay(NewtFactory.AWT, null); // local display - Screen nScreen = NewtFactory.createScreen(NewtFactory.AWT, nDisplay, 0); // screen 0 - nWindow = NewtFactory.createWindow(NewtFactory.AWT, nScreen, caps); + Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display + Screen nScreen = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0 + nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps); } window = GLWindow.create(nWindow, caps); diff --git a/src/demos/es2/openmax/Cube.java b/src/demos/es2/openmax/Cube.java index 58d9626..ce78bc7 100644 --- a/src/demos/es2/openmax/Cube.java +++ b/src/demos/es2/openmax/Cube.java @@ -34,6 +34,7 @@ package demos.es2.openmax; import java.nio.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; +import javax.media.nativewindow.*; import com.sun.opengl.util.*; import com.sun.opengl.util.glsl.fixedfunc.*; @@ -319,9 +320,9 @@ public class Cube implements GLEventListener { Window nWindow = null; if(0!=(type&USE_AWT)) { - Display nDisplay = NewtFactory.createDisplay(NewtFactory.AWT, null); // local display - Screen nScreen = NewtFactory.createScreen(NewtFactory.AWT, nDisplay, 0); // screen 0 - nWindow = NewtFactory.createWindow(NewtFactory.AWT, nScreen, caps); + Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display + Screen nScreen = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0 + nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps); } GLWindow window = GLWindow.create(nWindow, caps); diff --git a/src/demos/es2/perftst/Perftst.java b/src/demos/es2/perftst/Perftst.java index ba47029..e6fa822 100755 --- a/src/demos/es2/perftst/Perftst.java +++ b/src/demos/es2/perftst/Perftst.java @@ -2,6 +2,7 @@ package demos.es2.perftst; import java.nio.*; import javax.media.opengl.*; +import javax.media.nativewindow.*; import com.sun.opengl.util.*; import com.sun.opengl.util.glsl.*; @@ -53,9 +54,9 @@ public class Perftst implements MouseListener, GLEventListener { Window nWindow = null; if(0!=(type&USE_AWT)) { - Display nDisplay = NewtFactory.createDisplay(NewtFactory.AWT, null); // local display - Screen nScreen = NewtFactory.createScreen(NewtFactory.AWT, nDisplay, 0); // screen 0 - nWindow = NewtFactory.createWindow(NewtFactory.AWT, nScreen, caps); + Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display + Screen nScreen = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0 + nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps); } window = GLWindow.create(nWindow, caps); diff --git a/src/jbullet/src/javabullet/demos/opengl/JOGL.java b/src/jbullet/src/javabullet/demos/opengl/JOGL.java index 451b362..1e3408e 100644 --- a/src/jbullet/src/javabullet/demos/opengl/JOGL.java +++ b/src/jbullet/src/javabullet/demos/opengl/JOGL.java @@ -24,7 +24,7 @@ package javabullet.demos.opengl; import com.sun.javafx.newt.*; -import javax.media.nwi.*; +import javax.media.nativewindow.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; import javax.media.opengl.util.*; @@ -84,9 +84,9 @@ public class JOGL implements WindowListener, MouseListener { Window nWindow = null; if(0!=(type&USE_AWT)) { - Display nDisplay = NewtFactory.createDisplay(NewtFactory.AWT, null); // local display - Screen nScreen = NewtFactory.createScreen(NewtFactory.AWT, nDisplay, 0); // screen 0 - nWindow = NewtFactory.createWindow(NewtFactory.AWT, nScreen, caps); + Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display + Screen nScreen = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0 + nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps); } window = GLWindow.create(nWindow, caps); |