From 845878f2864d451e38f6e188d142580e69ad1f03 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 11 Jun 2009 07:50:34 +0000 Subject: Changes in respect to JOGL2 revision 1929 git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@342 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4 --- java-dbg.sh | 4 +++- java-win32-dbg.bat | 6 ++++-- java-win32.bat | 2 +- src/demos/GLInfo.java | 6 +++--- src/demos/context/DualContext.java | 3 ++- src/demos/es1/RedSquare.java | 10 +++------- src/demos/es2/RedSquare.java | 21 ++++++++++++++------- src/demos/gears/Gears.java | 2 +- src/demos/proceduralTexturePhysics/Water.java | 2 +- src/demos/texture/TextureConvert.java | 4 ++-- 10 files changed, 34 insertions(+), 26 deletions(-) diff --git a/java-dbg.sh b/java-dbg.sh index 5e42f49..fd88bcd 100644 --- a/java-dbg.sh +++ b/java-dbg.sh @@ -1,5 +1,7 @@ #! /bin/sh -java -Dgluegen.debug.ProcAddressHelper=true -Dgluegen.debug.NativeLibrary=true -Dnativewindow.debug=all -Djogl.debug=all $* 2>&1 | tee java-dbg.log +# java -Dgluegen.debug.ProcAddressHelper=true -Dgluegen.debug.NativeLibrary=true -Dnativewindow.debug=all -Djogl.debug=all $* 2>&1 | tee java-dbg.log +java -Dnewt.debug=all -Dnativewindow.debug=all -Djogl.debug=all $* 2>&1 | tee java-dbg.log +# java -Djogl.debug=all $* 2>&1 | tee java-dbg.log diff --git a/java-win32-dbg.bat b/java-win32-dbg.bat index b6f17b5..c263813 100644 --- a/java-win32-dbg.bat +++ b/java-win32-dbg.bat @@ -1,5 +1,5 @@ -#set TOPDIR=C:\SUN\JOGL2 +REM set TOPDIR=C:\SUN\JOGL2 set TOPDIR=.. set J2RE_HOME=c:\jre6 set JAVA_HOME=c:\jdk6 @@ -14,6 +14,8 @@ echo CLASSPATH %CLASSPATH% echo PATH %PATH% -java "-Dgluegen.debug.ProcAddressHelper" "-Dgluegen.debug.NativeLibrary=true" "-Djava.library.path=%LIB_DIR%" "-Dnativewindow.debug=all" "-Djogl.debug=all" %1 %2 %3 %4 > java-win32-dbg.log 2>&1 +REM java "-Dgluegen.debug.ProcAddressHelper" "-Dgluegen.debug.NativeLibrary=true" "-Djava.library.path=%LIB_DIR%" "-Dnativewindow.debug=all" "-Djogl.debug=all" %1 %2 %3 %4 > java-win32-dbg.log 2>&1 +REM java "-Dgluegen.debug.NativeLibrary=true" "-Dnativewindow.debug=all" "-Djogl.debug=all" "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" "-Djava.library.path=%LIB_DIR%" %1 %2 %3 %4 > java-win32-dbg.log 2>&1 +java "-Dnativewindow.debug=all" "-Djogl.debug=all" "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" "-Djava.library.path=%LIB_DIR%" %1 %2 %3 %4 > java-win32-dbg.log 2>&1 diff --git a/java-win32.bat b/java-win32.bat index e41b18d..e9ed420 100644 --- a/java-win32.bat +++ b/java-win32.bat @@ -14,6 +14,6 @@ echo CLASSPATH %CLASSPATH% echo PATH %PATH% -java "-Djava.library.path=%LIB_DIR%" %1 %2 %3 %4 > java-win32.log 2>&1 +java "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" "-Djava.library.path=%LIB_DIR%" %1 %2 %3 %4 > java-win32.log 2>&1 diff --git a/src/demos/GLInfo.java b/src/demos/GLInfo.java index 7e7ac6a..ba5f337 100755 --- a/src/demos/GLInfo.java +++ b/src/demos/GLInfo.java @@ -18,8 +18,8 @@ public class GLInfo extends Thread implements GLEventListener { } private void init(String glprofile, int type) { - int width = 256; - int height = 256; + int width = 640; + int height = 480; glp = GLProfile.GetProfile(glprofile); System.err.println(glp+" GLInfo.start()"); try { @@ -93,7 +93,7 @@ public class GLInfo extends Thread implements GLEventListener { GL gl = drawable.getGL(); GLProfile glp = gl.getGLProfile(); - System.err.println(glp+" GLCapabilities POST: "+drawable.getGLCapabilities()); + System.err.println(glp+" GLCapabilities POST: "+drawable.getChosenGLCapabilities()); System.err.println(glp+" GL Profile: "+drawable.getGLProfile()); System.err.println(glp+" GL:" + gl); System.err.println(glp+" GL_VERSION: " + gl.glGetString(GL.GL_VERSION)); diff --git a/src/demos/context/DualContext.java b/src/demos/context/DualContext.java index 85c3078..dfb07f6 100755 --- a/src/demos/context/DualContext.java +++ b/src/demos/context/DualContext.java @@ -74,7 +74,8 @@ public class DualContext extends Canvas { public DualContext(AWTGraphicsConfiguration config) { super(unwrap(config)); NativeWindow win = NativeWindowFactory.getFactory(getClass()).getNativeWindow(this, config); - drawable = GLDrawableFactory.getFactory(win).createGLDrawable(win); + GLCapabilities glCaps = (GLCapabilities) win.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); + drawable = GLDrawableFactory.getFactory(glCaps.getGLProfile()).createGLDrawable(win); context1 = drawable.createContext(null); context2 = drawable.createContext(null); glu = new GLU(); diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index eb36474..79a3c26 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -74,14 +74,9 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo int width = 800; int height = 480; glp = GLProfile.GetProfile(glprofile); - System.err.println(glp+" RedSquare.run()"); + System.err.println(glp+" RedSquare.init() 1"); try { GLCapabilities caps = new GLCapabilities(glp); - // For emulation library, use 16 bpp - caps.setRedBits(5); - caps.setGreenBits(6); - caps.setBlueBits(5); - caps.setDepthBits(16); Window nWindow = null; if(0!=(type&USE_AWT)) { @@ -103,6 +98,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo window.setSize(width, height); // window.setFullscreen(true); window.setVisible(true); + window.enablePerfLog(true); } catch (Throwable t) { t.printStackTrace(); } @@ -119,7 +115,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo } public void run() { - System.err.println(glp+" RedSquare.run()"); + System.err.println(glp+" RedSquare.run() 0"); try { do { window.display(); diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java index 4b80c1c..cd3042c 100755 --- a/src/demos/es2/RedSquare.java +++ b/src/demos/es2/RedSquare.java @@ -11,7 +11,7 @@ import com.sun.opengl.util.glsl.*; import com.sun.javafx.newt.*; import com.sun.javafx.newt.opengl.*; -public class RedSquare extends Thread implements MouseListener, GLEventListener { +public class RedSquare extends Thread implements WindowListener, MouseListener, GLEventListener { private GLWindow window; private GLProfile glp; @@ -24,6 +24,18 @@ public class RedSquare extends Thread implements MouseListener, GLEventListener super(); } + public void windowResized(WindowEvent e) { } + + public void windowMoved(WindowEvent e) { } + + public void windowGainedFocus(WindowEvent e) { } + + public void windowLostFocus(WindowEvent e) { } + + public void windowDestroyNotify(WindowEvent e) { + quit = true; + } + public void mouseClicked(MouseEvent e) { System.out.println(glp+" mouseevent: "+e); switch(e.getClickCount()) { @@ -57,11 +69,6 @@ public class RedSquare extends Thread implements MouseListener, GLEventListener System.err.println(glp+" RedSquare.start()"); try { GLCapabilities caps = new GLCapabilities(glp); - // For emulation library, use 16 bpp - caps.setRedBits(5); - caps.setGreenBits(6); - caps.setBlueBits(5); - caps.setDepthBits(16); Window nWindow = null; if(0!=(type&USE_AWT)) { @@ -71,6 +78,7 @@ public class RedSquare extends Thread implements MouseListener, GLEventListener } window = GLWindow.create(nWindow, caps); + window.addWindowListener(this); window.addMouseListener(this); window.addGLEventListener(this); // window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_CURRENT); // default @@ -222,7 +230,6 @@ public class RedSquare extends Thread implements MouseListener, GLEventListener st=null; pmvMatrix.destroy(); pmvMatrix=null; - quit=true; System.out.println(glp+" RedSquare.dispose: fin"); } diff --git a/src/demos/gears/Gears.java b/src/demos/gears/Gears.java index aff336a..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 GLCapabilities: " + drawable.getGLCapabilities()); + System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities()); gl.setSwapInterval(1); diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java index a5df90c..89c1495 100644 --- a/src/demos/proceduralTexturePhysics/Water.java +++ b/src/demos/proceduralTexturePhysics/Water.java @@ -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 = parentWindow.getGLCapabilities(); + GLCapabilities caps = parentWindow.getChosenGLCapabilities(); caps.setDoubleBuffered(false); if (!GLDrawableFactory.getFactory(caps.getGLProfile()).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 8df6848..aaf75a2 100755 --- a/src/demos/texture/TextureConvert.java +++ b/src/demos/texture/TextureConvert.java @@ -73,11 +73,11 @@ public class TextureConvert { caps.setDoubleBuffered(false); // Make a pbuffer to get an offscreen context - if (!GLDrawableFactory.getFactory(caps).canCreateGLPbuffer()) { + if (!GLDrawableFactory.getFactory(caps.getGLProfile()).canCreateGLPbuffer()) { System.out.println("Pbuffer support not available (required to run this demo)"); System.exit(1); } - GLPbuffer pbuffer = GLDrawableFactory.getFactory(caps).createGLPbuffer(caps, null, 2, 2, null); + GLPbuffer pbuffer = GLDrawableFactory.getFactory(caps.getGLProfile()).createGLPbuffer(caps, null, 2, 2, null); pbuffer.getContext().makeCurrent(); GL gl = pbuffer.getGL(); -- cgit v1.2.3