summaryrefslogtreecommitdiffstats
path: root/src/demos
diff options
context:
space:
mode:
Diffstat (limited to 'src/demos')
-rwxr-xr-xsrc/demos/GLInfo.java6
-rwxr-xr-xsrc/demos/context/DualContext.java3
-rwxr-xr-xsrc/demos/es1/RedSquare.java10
-rwxr-xr-xsrc/demos/es2/RedSquare.java21
-rw-r--r--src/demos/gears/Gears.java2
-rw-r--r--src/demos/proceduralTexturePhysics/Water.java2
-rwxr-xr-xsrc/demos/texture/TextureConvert.java4
7 files changed, 26 insertions, 22 deletions
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();