summaryrefslogtreecommitdiffstats
path: root/src/demos
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-06-03 19:59:19 +0000
committerSven Gothel <[email protected]>2009-06-03 19:59:19 +0000
commita1c838f382cef1c0fac5ec291f74e71cf791f8be (patch)
treefbe6dd9a9e6fa9264b2c304984eebe77377c1117 /src/demos
parent77a86250f12bd026c0fac6ba6cd6ff3f196f1d95 (diff)
Fixes against JOGL2 revision 1922 - Multi GL Profiles, plus setenv scripts
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@338 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos')
-rwxr-xr-xsrc/demos/GLInfo.java120
-rwxr-xr-xsrc/demos/context/DualContext.java6
-rwxr-xr-xsrc/demos/cubefbo/Main.java2
-rwxr-xr-xsrc/demos/es1/Info.java5
-rwxr-xr-xsrc/demos/es1/RedSquare.java63
-rwxr-xr-xsrc/demos/es1/angeles/AngelesGL.java6
-rwxr-xr-xsrc/demos/es1/angeles/AngelesGLil.java6
-rwxr-xr-xsrc/demos/es1/angeles/Main.java3
-rw-r--r--src/demos/es1/cube/Cube.java5
-rw-r--r--src/demos/es1/cube/CubeImmModeSink.java7
-rwxr-xr-xsrc/demos/es1/cubefbo/Main.java3
-rwxr-xr-xsrc/demos/es2/RedSquare.java60
-rw-r--r--src/demos/es2/openmax/Cube.java5
-rwxr-xr-xsrc/demos/es2/openmax/MovieCube.java3
-rwxr-xr-xsrc/demos/es2/openmax/MovieSimple.java9
-rwxr-xr-xsrc/demos/es2/perftst/PerfTextLoad.java4
-rwxr-xr-xsrc/demos/es2/perftst/PerfUniLoad.java4
-rwxr-xr-xsrc/demos/es2/perftst/PerfVBOLoad.java4
-rwxr-xr-xsrc/demos/es2/perftst/Perftst.java3
-rwxr-xr-xsrc/demos/gamma/TestGamma.java38
-rw-r--r--src/demos/gears/Gears.java2
-rw-r--r--src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java6
-rw-r--r--src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java2
-rwxr-xr-xsrc/demos/j2d/TestOverlay.java2
-rwxr-xr-xsrc/demos/j2d/TestTextRenderer.java2
-rwxr-xr-xsrc/demos/j2d/TestTextureRenderer.java3
-rwxr-xr-xsrc/demos/j2d/TextCube.java6
-rwxr-xr-xsrc/demos/j2d/TextFlow.java6
-rw-r--r--src/demos/jgears/JGears.java3
-rwxr-xr-xsrc/demos/jrefract/JRefract.java3
-rwxr-xr-xsrc/demos/misc/GLCapsTableDemo.java2
-rwxr-xr-xsrc/demos/misc/Picking.java4
-rwxr-xr-xsrc/demos/misc/TiledRendering.java9
-rwxr-xr-xsrc/demos/multisample/Multisample.java2
-rwxr-xr-xsrc/demos/particles/engine/GLComponent.java2
-rw-r--r--src/demos/proceduralTexturePhysics/Water.java6
-rwxr-xr-xsrc/demos/texture/TextureConvert.java9
-rw-r--r--src/demos/vertexBufferObject/VertexBufferObject.java6
-rwxr-xr-xsrc/demos/xtrans/XTDesktopManager.java4
-rwxr-xr-xsrc/demos/xtrans/XTDesktopPane.java5
40 files changed, 274 insertions, 166 deletions
diff --git a/src/demos/GLInfo.java b/src/demos/GLInfo.java
index a5a0a91..d222944 100755
--- a/src/demos/GLInfo.java
+++ b/src/demos/GLInfo.java
@@ -8,34 +8,35 @@ import javax.media.nativewindow.*;
import com.sun.javafx.newt.*;
import com.sun.javafx.newt.opengl.*;
-public class GLInfo implements GLEventListener {
+public class GLInfo extends Thread implements GLEventListener {
private GLWindow window;
+ private GLProfile glp;
- private void run(int type) {
+ public GLInfo() {
+ super();
+ }
+
+ private void start(String glprofile, int type) {
int width = 256;
int height = 256;
- System.err.println("GLInfo.run()");
- if(null==glprofile) {
- GLProfile.setProfileGLAny();
- } else {
- GLProfile.setProfile(glprofile);
- }
+ glp = GLProfile.GetProfile(glprofile);
+ System.err.println(glp+" GLInfo.start()");
try {
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(glp);
// 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(glp+" GLCapabilities PRE : "+caps);
Window nWindow = null;
if(0!=(type&USE_AWT)) {
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);
+ System.err.println(glp+" "+nWindow);
//nWindow.setVisible(true);
}
window = GLWindow.create(nWindow, caps);
@@ -45,14 +46,32 @@ public class GLInfo implements GLEventListener {
// Size OpenGL to Video Surface
window.setSize(width, height);
// window.setFullscreen(true);
+
+ start();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+
+ public void run() {
+ try {
+ System.err.println(glp+" GLInfo.run()");
+
window.setVisible(true);
window.display();
+ try {
+ Thread.sleep(500);
+ } catch (Exception e) {}
+
+ window.display();
+
// Shut things down cooperatively
window.destroy();
window.getFactory().shutdown();
- System.out.println("GLInfo shut down cleanly.");
+ System.out.println(glp+" GLInfo shut down cleanly.");
} catch (Throwable t) {
t.printStackTrace();
}
@@ -60,63 +79,78 @@ public class GLInfo implements GLEventListener {
public void init(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
-
- 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));
- System.err.println("GL_EXTENSIONS: ");
- System.err.println(" " + gl.glGetString(GL.GL_EXTENSIONS));
- System.err.println("Platform EXTENSIONS: ");
- System.err.println(" " + gl.getContext().getPlatformExtensionsString());
- System.err.println("Availability Tests: ");
- 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"));
+ GLProfile glp = gl.getGLProfile();
+
+ System.err.println(glp+" GLCapabilities POST: "+drawable.getGLCapabilities());
+ 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));
+ System.err.println(glp+" GL_EXTENSIONS: ");
+ System.err.println(glp+" " + gl.glGetString(GL.GL_EXTENSIONS));
+ System.err.println(glp+" Platform EXTENSIONS: ");
+ System.err.println(glp+" " + gl.getContext().getPlatformExtensionsString());
+ System.err.println(glp+" Availability Tests: ");
+ System.err.println(glp+" Fixed: glBegin: "+gl.isFunctionAvailable("glBegin"));
+ System.err.println(glp+" ES1 : glClearColorx: "+gl.isFunctionAvailable("glClearColorx"));
+ System.err.println(glp+" GLSL : glUseProgram: "+gl.isFunctionAvailable("glUseProgram"));
+ System.err.println(glp+" GL_ARB_vertex_array_object: "+gl.isExtensionAvailable("GL_ARB_vertex_array_object"));
+ System.err.println(glp+" GL_ARB_vertex_array_object: glBindVertexArray: "+gl.isFunctionAvailable("glBindVertexArray"));
+ System.err.println(glp+" GL_EXT_gpu_shader4: "+gl.isExtensionAvailable("GL_EXT_gpu_shader4"));
+ System.err.println(glp+" GL_EXT_gpu_shader4: glBindFragDataLocation"+gl.isFunctionAvailable("glBindFragDataLocation"));
+ System.err.println(glp+" GL_VERSION_3_0: "+gl.isExtensionAvailable("GL_VERSION_3_0"));
+ System.err.println(glp+" GL_VERSION_3_0: glBeginConditionalRender: "+gl.isFunctionAvailable("glBeginConditionalRender"));
+ System.err.println(glp+" GL_ARB_texture_buffer_object: "+gl.isExtensionAvailable("GL_ARB_texture_buffer_object"));
+ System.err.println(glp+" GL_ARB_texture_buffer_object: glTexBuffer: "+gl.isFunctionAvailable("glTexBuffer"));
+ System.err.println(glp+" GL_VERSION_3_1: "+gl.isExtensionAvailable("GL_VERSION_3_1"));
+ System.err.println(glp+" EGL : eglCreateContext: "+gl.isFunctionAvailable("eglCreateContext"));
+ System.err.println(glp+" EGLEx: eglCreateImage: "+gl.isFunctionAvailable("eglCreateImage"));
+ System.err.println(glp+" GLX : glXCreateWindow: "+gl.isFunctionAvailable("glXCreateWindow"));
+ System.err.println(glp+" GLX_ARB_create_context: "+gl.isExtensionAvailable("GLX_ARB_create_context"));
+ System.err.println(glp+" WGL : wglCreateContext: "+gl.isFunctionAvailable("wglCreateContext"));
+ System.err.println(glp+" CGL : CGLCreateContext: "+gl.isFunctionAvailable("CGLCreateContext"));
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
}
public void dispose(GLAutoDrawable drawable) {
+ GL gl = drawable.getGL();
+ GLProfile glp = gl.getGLProfile();
+
+ System.err.println(glp+" dispose");
}
public void display(GLAutoDrawable drawable) {
+ GL gl = drawable.getGL();
+ GLProfile glp = gl.getGLProfile();
+
+ System.err.println(glp+" display: "+displayed);
+ displayed++;
}
+ int displayed = 0;
public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
}
public static int USE_NEWT = 0;
public static int USE_AWT = 1 << 0;
- public static String glprofile = null;
public static void main(String[] args) {
+ String glprofile = null;
int type = USE_NEWT ;
+ int num=0;
for(int i=args.length-1; i>=0; i--) {
if(args[i].equals("-awt")) {
type |= USE_AWT;
}
if(args[i].startsWith("-GL")) {
glprofile=args[i].substring(1);
+ new GLInfo().start(glprofile, type);
+ num++;
}
}
- new GLInfo().run(type);
- System.exit(0);
+ if(0==num) {
+ new GLInfo().start(glprofile, type);
+ }
}
}
diff --git a/src/demos/context/DualContext.java b/src/demos/context/DualContext.java
index be174bb..85c3078 100755
--- a/src/demos/context/DualContext.java
+++ b/src/demos/context/DualContext.java
@@ -74,7 +74,7 @@ public class DualContext extends Canvas {
public DualContext(AWTGraphicsConfiguration config) {
super(unwrap(config));
NativeWindow win = NativeWindowFactory.getFactory(getClass()).getNativeWindow(this, config);
- drawable = GLDrawableFactory.getFactory().createGLDrawable(win);
+ drawable = GLDrawableFactory.getFactory(win).createGLDrawable(win);
context1 = drawable.createContext(null);
context2 = drawable.createContext(null);
glu = new GLU();
@@ -140,12 +140,10 @@ public class DualContext extends Canvas {
public static void main(String[] args) {
JFrame frame = new JFrame("Dual OpenGL Context Test");
- // Get the GraphicsConfigurationFactory ready for OpenGL work
- GLDrawableFactory.getFactory();
AWTGraphicsScreen screen = (AWTGraphicsScreen)AWTGraphicsScreen.createDefault();
AWTGraphicsConfiguration config = (AWTGraphicsConfiguration)
- GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(new GLCapabilities(), null, screen);
+ GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(new GLCapabilities(null), null, screen);
final DualContext dc = new DualContext(config);
frame.getContentPane().add(dc, BorderLayout.CENTER);
diff --git a/src/demos/cubefbo/Main.java b/src/demos/cubefbo/Main.java
index 34a7e0c..e6d0cc9 100755
--- a/src/demos/cubefbo/Main.java
+++ b/src/demos/cubefbo/Main.java
@@ -46,7 +46,7 @@ public class Main {
public static void main(String[] args) {
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(null);
GLCanvas canvas = new GLCanvas(caps);
FBCubes cubes = new FBCubes();
diff --git a/src/demos/es1/Info.java b/src/demos/es1/Info.java
index de3d16d..17fe5b1 100755
--- a/src/demos/es1/Info.java
+++ b/src/demos/es1/Info.java
@@ -16,9 +16,8 @@ public class Info implements GLEventListener {
int width = 10;
int height = 10;
System.err.println("Info.run()");
- GLProfile.setProfileGL2ES1();
try {
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(GLProfile.GetProfileGL2ES1());
// For emulation library, use 16 bpp
caps.setRedBits(5);
caps.setGreenBits(6);
@@ -54,7 +53,7 @@ public class Info implements GLEventListener {
public void init(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
- System.err.println("GL Profile: "+GLProfile.getProfile());
+ System.err.println("GL Profile: "+gl.getGLProfile());
System.err.println("GL_VERSION: " + gl.glGetString(GL.GL_VERSION));
System.err.println("GL_EXTENSIONS: ");
System.err.println(" " + gl.glGetString(GL.GL_EXTENSIONS));
diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java
index 2948f42..eb6275d 100755
--- a/src/demos/es1/RedSquare.java
+++ b/src/demos/es1/RedSquare.java
@@ -11,12 +11,17 @@ import com.sun.opengl.util.glsl.fixedfunc.*;
import com.sun.javafx.newt.*;
import com.sun.javafx.newt.opengl.*;
-public class RedSquare implements WindowListener, KeyListener, MouseListener, GLEventListener {
+public class RedSquare extends Thread implements WindowListener, KeyListener, MouseListener, GLEventListener {
private GLWindow window;
+ private GLProfile glp;
private GLU glu;
private boolean quit = false;
+ public RedSquare() {
+ super();
+ }
+
public void windowResized(WindowEvent e) {
}
@@ -30,17 +35,17 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL
public void windowLostFocus(WindowEvent e) { }
public void keyPressed(KeyEvent e) {
- System.out.println(e);
+ System.out.println(glp+" "+e);
}
public void keyReleased(KeyEvent e) {
- System.out.println(e);
+ System.out.println(glp+" "+e);
}
public void keyTyped(KeyEvent e) {
- System.out.println(e);
+ System.out.println(glp+" "+e);
}
public void mouseClicked(MouseEvent e) {
- System.out.println("mouseevent: "+e);
+ System.out.println(glp+" mouseevent: "+e);
switch(e.getClickCount()) {
case 1:
window.setFullscreen(!window.isFullscreen());
@@ -65,13 +70,13 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL
public void mouseWheelMoved(MouseEvent e) {
}
- private void run(int type) {
+ private void start(String glprofile, int type) {
int width = 800;
int height = 480;
- System.err.println("RedSquare.run()");
- GLProfile.setProfileGLAny();
+ glp = GLProfile.GetProfile(glprofile);
+ System.err.println(glp+" RedSquare.run()");
try {
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(glp);
// For emulation library, use 16 bpp
caps.setRedBits(5);
caps.setGreenBits(6);
@@ -97,6 +102,16 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL
// Size OpenGL to Video Surface
window.setSize(width, height);
// window.setFullscreen(true);
+
+ start();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ public void run() {
+ System.err.println(glp+" RedSquare.run()");
+ try {
window.setVisible(true);
do {
@@ -106,7 +121,7 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL
// Shut things down cooperatively
window.destroy();
window.getFactory().shutdown();
- System.out.println("RedSquare shut down cleanly.");
+ System.out.println(glp+" RedSquare shut down cleanly.");
} catch (Throwable t) {
t.printStackTrace();
}
@@ -125,12 +140,12 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL
public void init(GLAutoDrawable drawable) {
GL2ES1 gl = FixedFuncUtil.getFixedFuncImpl(drawable.getGL());
- System.err.println("Entering initialization");
- System.err.println("GL Profile: "+GLProfile.getProfile());
- System.err.println("GL:" + gl);
- System.err.println("GL_VERSION=" + gl.glGetString(gl.GL_VERSION));
- System.err.println("GL_EXTENSIONS:");
- System.err.println(" " + gl.glGetString(gl.GL_EXTENSIONS));
+ System.err.println(glp+" Entering initialization");
+ System.err.println(glp+" GL Profile: "+gl.getGLProfile());
+ System.err.println(glp+" GL:" + gl);
+ System.err.println(glp+" GL_VERSION=" + gl.glGetString(gl.GL_VERSION));
+ System.err.println(glp+" GL_EXTENSIONS:");
+ System.err.println(glp+" " + gl.glGetString(gl.GL_EXTENSIONS));
glu = GLU.createGLU();
@@ -186,7 +201,7 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL
public void dispose(GLAutoDrawable drawable) {
GL2ES1 gl = drawable.getGL().getGL2ES1();
- System.out.println("Demo.dispose: "+gl.getContext());
+ System.out.println(glp+" RedSquare.dispose: "+gl.getContext());
gl.glDisableClientState(gl.GL_VERTEX_ARRAY);
gl.glDisableClientState(gl.GL_COLOR_ARRAY);
glu.destroy();
@@ -195,7 +210,7 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL
colors = null;
vertices.clear();
vertices = null;
- System.out.println("Demo.dispose: fin");
+ System.out.println(glp+" RedSquare.dispose: fin");
}
public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
@@ -205,13 +220,21 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL
public static int USE_AWT = 1 << 0;
public static void main(String[] args) {
+ String glprofile = null;
int type = USE_NEWT ;
+ int num=0;
for(int i=args.length-1; i>=0; i--) {
if(args[i].equals("-awt")) {
type |= USE_AWT;
}
+ if(args[i].startsWith("-GL")) {
+ glprofile=args[i].substring(1);
+ new RedSquare().start(glprofile, type);
+ num++;
+ }
+ }
+ if(0==num) {
+ new RedSquare().start(glprofile, type);
}
- new RedSquare().run(type);
- System.exit(0);
}
}
diff --git a/src/demos/es1/angeles/AngelesGL.java b/src/demos/es1/angeles/AngelesGL.java
index fbb1322..bae7b5c 100755
--- a/src/demos/es1/angeles/AngelesGL.java
+++ b/src/demos/es1/angeles/AngelesGL.java
@@ -295,12 +295,12 @@ public class GLSpatial {
gl.glGenBuffers(1, tmp, 0);
vboName = tmp[0];
- vArrayData = GLArrayDataWrapper.createFixed(gl.GL_VERTEX_ARRAY, vComps, GL.GL_FLOAT, false,
+ vArrayData = GLArrayDataWrapper.createFixed(gl, gl.GL_VERTEX_ARRAY, vComps, GL.GL_FLOAT, false,
0, pBuffer, vboName, vOffset);
- cArrayData = GLArrayDataWrapper.createFixed(gl.GL_COLOR_ARRAY, cComps, GL.GL_FLOAT, false,
+ cArrayData = GLArrayDataWrapper.createFixed(gl, gl.GL_COLOR_ARRAY, cComps, GL.GL_FLOAT, false,
0, pBuffer, vboName, cOffset);
if(useNormalArray) {
- nArrayData = GLArrayDataWrapper.createFixed(gl.GL_NORMAL_ARRAY, nComps, GL.GL_FLOAT, false,
+ nArrayData = GLArrayDataWrapper.createFixed(gl, gl.GL_NORMAL_ARRAY, nComps, GL.GL_FLOAT, false,
0, pBuffer, vboName, nOffset);
}
}
diff --git a/src/demos/es1/angeles/AngelesGLil.java b/src/demos/es1/angeles/AngelesGLil.java
index 2aeb795..aaae01e 100755
--- a/src/demos/es1/angeles/AngelesGLil.java
+++ b/src/demos/es1/angeles/AngelesGLil.java
@@ -298,12 +298,12 @@ public class GLSpatial {
interlArray.position(count*(vComps+cComps+nComps));
interlArray.flip();
- vArrayData = GLArrayDataWrapper.createFixed(gl.GL_VERTEX_ARRAY, vComps, GL.GL_FLOAT, false,
+ vArrayData = GLArrayDataWrapper.createFixed(gl, gl.GL_VERTEX_ARRAY, vComps, GL.GL_FLOAT, false,
bStride, pBuffer, vboName, vOffset);
- cArrayData = GLArrayDataWrapper.createFixed(gl.GL_COLOR_ARRAY, cComps, GL.GL_FLOAT, false,
+ cArrayData = GLArrayDataWrapper.createFixed(gl, gl.GL_COLOR_ARRAY, cComps, GL.GL_FLOAT, false,
bStride, pBuffer, vboName, cOffset);
if(useNormalArray) {
- nArrayData = GLArrayDataWrapper.createFixed(gl.GL_NORMAL_ARRAY, nComps, GL.GL_FLOAT, false,
+ nArrayData = GLArrayDataWrapper.createFixed(gl, gl.GL_NORMAL_ARRAY, nComps, GL.GL_FLOAT, false,
bStride, pBuffer, vboName, nOffset);
}
}
diff --git a/src/demos/es1/angeles/Main.java b/src/demos/es1/angeles/Main.java
index 3346a1f..3b8400b 100755
--- a/src/demos/es1/angeles/Main.java
+++ b/src/demos/es1/angeles/Main.java
@@ -44,10 +44,9 @@ public class Main implements WindowListener, MouseListener {
int height = 480;
System.out.println("angeles.Main.run()");
//GLProfile.setProfileGL2ES1();
- GLProfile.setProfileGLAny();
try {
// Hook this into EGL
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(null);
// 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 3a8a22e..8917697 100644
--- a/src/demos/es1/cube/Cube.java
+++ b/src/demos/es1/cube/Cube.java
@@ -85,7 +85,7 @@ public class Cube implements GLEventListener {
if(!innerCube) {
System.err.println("Entering initialization");
- System.err.println("GL Profile: "+GLProfile.getProfile());
+ System.err.println("GL Profile: "+gl.getGLProfile());
System.err.println("GL:" + gl);
System.err.println("GL_VERSION=" + gl.glGetString(gl.GL_VERSION));
System.err.println("GL_EXTENSIONS:");
@@ -292,9 +292,8 @@ public class Cube implements GLEventListener {
int width = 800;
int height = 480;
System.err.println("Cube.run()");
- GLProfile.setProfileGLAny();
try {
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(null);
// 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 dcc0487..b072535 100644
--- a/src/demos/es1/cube/CubeImmModeSink.java
+++ b/src/demos/es1/cube/CubeImmModeSink.java
@@ -58,7 +58,7 @@ public class CubeImmModeSink implements GLEventListener {
}
if(vboCubeF==null) {
- ImmModeSink vbo = ImmModeSink.createFixed(GL.GL_STATIC_DRAW, 36,
+ ImmModeSink vbo = ImmModeSink.createFixed(gl, GL.GL_STATIC_DRAW, 36,
3, GL.GL_SHORT, // vertex
4, GL.GL_FLOAT, // color
3, GL.GL_BYTE, // normal
@@ -172,7 +172,7 @@ public class CubeImmModeSink implements GLEventListener {
if(!innerCube) {
System.err.println("Entering initialization");
- System.err.println("GL Profile: "+GLProfile.getProfile());
+ System.err.println("GL Profile: "+gl.getGLProfile());
System.err.println("GL:" + gl);
System.err.println("GL_VERSION=" + gl.glGetString(gl.GL_VERSION));
System.err.println("GL_EXTENSIONS:");
@@ -380,9 +380,8 @@ public class CubeImmModeSink implements GLEventListener {
int width = 800;
int height = 480;
System.err.println("CubeImmModeSink.run()");
- GLProfile.setProfileGLAny();
try {
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(null);
// 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 1cb0bdc..51a03c7 100755
--- a/src/demos/es1/cubefbo/Main.java
+++ b/src/demos/es1/cubefbo/Main.java
@@ -51,10 +51,9 @@ public class Main implements WindowListener, MouseListener {
int width = 800;
int height = 480;
System.out.println("cubefbo.Main.run()");
- GLProfile.setProfileGLAny();
try {
// Hook this into EGL
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(null);
// 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 822a85c..a01a41a 100755
--- a/src/demos/es2/RedSquare.java
+++ b/src/demos/es2/RedSquare.java
@@ -11,16 +11,21 @@ import com.sun.opengl.util.glsl.*;
import com.sun.javafx.newt.*;
import com.sun.javafx.newt.opengl.*;
-public class RedSquare implements MouseListener, GLEventListener {
+public class RedSquare extends Thread implements MouseListener, GLEventListener {
private GLWindow window;
+ private GLProfile glp;
private GLU glu;
private boolean quit = false;
private long startTime;
private long curTime;
+ public RedSquare() {
+ super();
+ }
+
public void mouseClicked(MouseEvent e) {
- System.out.println("mouseevent: "+e);
+ System.out.println(glp+" mouseevent: "+e);
switch(e.getClickCount()) {
case 1:
window.setFullscreen(!window.isFullscreen());
@@ -45,13 +50,13 @@ public class RedSquare implements MouseListener, GLEventListener {
public void mouseWheelMoved(MouseEvent e) {
}
- private void run(int type) {
+ private void start(String glprofile, int type) {
int width = 800;
int height = 480;
- System.err.println("RedSquare.run()");
- GLProfile.setProfileGL2ES2();
+ glp = GLProfile.GetProfile(glprofile);
+ System.err.println(glp+" RedSquare.start()");
try {
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(glp);
// For emulation library, use 16 bpp
caps.setRedBits(5);
caps.setGreenBits(6);
@@ -73,10 +78,21 @@ public class RedSquare implements MouseListener, GLEventListener {
// Size OpenGL to Video Surface
window.setSize(width, height);
- window.setFullscreen(true);
+ // window.setFullscreen(true);
+
+ start();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ public void run() {
+ System.err.println(glp+" RedSquare.run()");
+ try {
window.setVisible(true);
startTime = System.currentTimeMillis();
+
while (!quit && ((curTime = System.currentTimeMillis()) - startTime) < 20000) {
window.display();
}
@@ -84,7 +100,7 @@ public class RedSquare implements MouseListener, GLEventListener {
// Shut things down cooperatively
window.destroy();
window.getFactory().shutdown();
- System.out.println("RedSquare shut down cleanly.");
+ System.out.println(glp+" RedSquare shut down cleanly.");
} catch (Throwable t) {
t.printStackTrace();
}
@@ -118,10 +134,10 @@ public class RedSquare implements MouseListener, GLEventListener {
public void init(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
glu = GLU.createGLU();
- System.err.println("Entering initialization");
- System.err.println("GL_VERSION=" + gl.glGetString(gl.GL_VERSION));
- System.err.println("GL_EXTENSIONS:");
- System.err.println(" " + gl.glGetString(gl.GL_EXTENSIONS));
+ System.err.println(glp+" Entering initialization");
+ System.err.println(glp+" GL_VERSION=" + gl.glGetString(gl.GL_VERSION));
+ System.err.println(glp+" GL_EXTENSIONS:");
+ System.err.println(glp+" " + gl.glGetString(gl.GL_EXTENSIONS));
pmvMatrix = new PMVMatrix();
@@ -139,7 +155,7 @@ public class RedSquare implements MouseListener, GLEventListener {
throw new GLException("Error setting PMVMatrix in shader: "+st);
}
// Allocate vertex arrays
- GLArrayDataClient vertices = GLArrayDataClient.createGLSL("mgl_Vertex", 3, gl.GL_FLOAT, false, 4);
+ GLArrayDataClient vertices = GLArrayDataClient.createGLSL(gl, "mgl_Vertex", 3, gl.GL_FLOAT, false, 4);
{
// Fill them up
FloatBuffer verticeb = (FloatBuffer)vertices.getBuffer();
@@ -150,7 +166,7 @@ public class RedSquare implements MouseListener, GLEventListener {
}
vertices.seal(gl, true);
- GLArrayDataClient colors = GLArrayDataClient.createGLSL("mgl_Color", 4, gl.GL_FLOAT, false, 4);
+ GLArrayDataClient colors = GLArrayDataClient.createGLSL(gl, "mgl_Color", 4, gl.GL_FLOAT, false, 4);
{
// Fill them up
FloatBuffer colorb = (FloatBuffer)colors.getBuffer();
@@ -168,7 +184,7 @@ public class RedSquare implements MouseListener, GLEventListener {
st.glUseProgram(gl, false);
// Let's show the completed shader state ..
- System.out.println(st);
+ System.out.println(glp+" "+st);
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
@@ -193,12 +209,14 @@ public class RedSquare implements MouseListener, GLEventListener {
public void dispose(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
+ System.out.println(glp+" RedSquare.dispose: "+gl.getContext());
st.destroy(gl);
st=null;
pmvMatrix.destroy();
pmvMatrix=null;
quit=true;
+ System.out.println(glp+" RedSquare.dispose: fin");
}
public void display(GLAutoDrawable drawable) {
@@ -235,13 +253,21 @@ public class RedSquare implements MouseListener, GLEventListener {
public static int USE_AWT = 1 << 0;
public static void main(String[] args) {
+ String glprofile = null;
int type = USE_NEWT ;
+ int num=0;
for(int i=args.length-1; i>=0; i--) {
if(args[i].equals("-awt")) {
type |= USE_AWT;
}
+ if(args[i].startsWith("-GL")) {
+ glprofile=args[i].substring(1);
+ new RedSquare().start(glprofile, type);
+ num++;
+ }
+ }
+ if(0==num) {
+ new RedSquare().start(glprofile, type);
}
- new RedSquare().run(type);
- System.exit(0);
}
}
diff --git a/src/demos/es2/openmax/Cube.java b/src/demos/es2/openmax/Cube.java
index ce78bc7..706d8b5 100644
--- a/src/demos/es2/openmax/Cube.java
+++ b/src/demos/es2/openmax/Cube.java
@@ -101,7 +101,7 @@ public class Cube implements GLEventListener {
if(!innerCube) {
System.err.println("Entering initialization");
- System.err.println("GL Profile: "+GLProfile.getProfile());
+ System.err.println("GL Profile: "+gl.getGLProfile());
System.err.println("GL:" + gl);
System.err.println("GL_VERSION=" + gl.glGetString(gl.GL_VERSION));
System.err.println("GL_EXTENSIONS:");
@@ -309,9 +309,8 @@ public class Cube implements GLEventListener {
int width = 800;
int height = 480;
System.err.println("Cube.run()");
- GLProfile.setProfileGLAny();
try {
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(null);
// 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 270cf2a..1a0fb93 100755
--- a/src/demos/es2/openmax/MovieCube.java
+++ b/src/demos/es2/openmax/MovieCube.java
@@ -86,9 +86,8 @@ public class MovieCube implements MouseListener, GLEventListener, OMXEventListen
private void run() {
System.err.println("MovieCube.run()");
- GLProfile.setProfileGL2ES2();
try {
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(GLProfile.GetProfileGL2ES2());
// 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 ecbb0b2..cba3c2c 100755
--- a/src/demos/es2/openmax/MovieSimple.java
+++ b/src/demos/es2/openmax/MovieSimple.java
@@ -93,9 +93,8 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList
private void run() {
System.err.println("MovieSimple.run()");
- GLProfile.setProfileGL2ES2();
try {
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(GLProfile.GetProfileGL2ES2());
// For emulation library, use 16 bpp
caps.setRedBits(5);
caps.setGreenBits(6);
@@ -198,7 +197,7 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList
}
// Allocate vertex array
- GLArrayDataServer vertices = GLArrayDataServer.createGLSL("mgl_Vertex", 3, gl.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
+ GLArrayDataServer vertices = GLArrayDataServer.createGLSL(gl, "mgl_Vertex", 3, gl.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
{
// Fill them up
FloatBuffer verticeb = (FloatBuffer)vertices.getBuffer();
@@ -210,7 +209,7 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList
vertices.seal(gl, true);
// Allocate texcoord array
- GLArrayDataServer texcoord = GLArrayDataServer.createGLSL("mgl_MultiTexCoord", 2, gl.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
+ GLArrayDataServer texcoord = GLArrayDataServer.createGLSL(gl, "mgl_MultiTexCoord", 2, gl.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
{
// Fill them up
FloatBuffer texcoordb = (FloatBuffer)texcoord.getBuffer();
@@ -221,7 +220,7 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList
}
texcoord.seal(gl, true);
- GLArrayDataServer colors = GLArrayDataServer.createGLSL("mgl_Color", 4, gl.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
+ GLArrayDataServer colors = GLArrayDataServer.createGLSL(gl, "mgl_Color", 4, gl.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
{
// Fill them up
FloatBuffer colorb = (FloatBuffer)colors.getBuffer();
diff --git a/src/demos/es2/perftst/PerfTextLoad.java b/src/demos/es2/perftst/PerfTextLoad.java
index 3d2c5ce..55aad9a 100755
--- a/src/demos/es2/perftst/PerfTextLoad.java
+++ b/src/demos/es2/perftst/PerfTextLoad.java
@@ -59,7 +59,7 @@ public class PerfTextLoad extends PerfModule {
st.glUseProgram(gl, true);
- GLArrayDataServer vertices = GLArrayDataServer.createGLSL("mgl_Vertex", 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ GLArrayDataServer vertices = GLArrayDataServer.createGLSL(gl, "mgl_Vertex", 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
{
FloatBuffer vb = (FloatBuffer)vertices.getBuffer();
vb.put(0f); vb.put(0f);
@@ -69,7 +69,7 @@ public class PerfTextLoad extends PerfModule {
}
vertices.seal(gl, true);
- GLArrayDataServer texCoords = GLArrayDataServer.createGLSL("mgl_MultiTexCoord0", 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ GLArrayDataServer texCoords = GLArrayDataServer.createGLSL(gl, "mgl_MultiTexCoord0", 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
{
FloatBuffer cb = (FloatBuffer)texCoords.getBuffer();
cb.put(0f); cb.put(0f);
diff --git a/src/demos/es2/perftst/PerfUniLoad.java b/src/demos/es2/perftst/PerfUniLoad.java
index 95e13c4..a87d386 100755
--- a/src/demos/es2/perftst/PerfUniLoad.java
+++ b/src/demos/es2/perftst/PerfUniLoad.java
@@ -38,7 +38,7 @@ public class PerfUniLoad extends PerfModule {
st.glUseProgram(gl, true);
- GLArrayDataServer vertices = GLArrayDataServer.createGLSL("mgl_Vertex", 3, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ GLArrayDataServer vertices = GLArrayDataServer.createGLSL(gl, "mgl_Vertex", 3, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
{
FloatBuffer vb = (FloatBuffer)vertices.getBuffer();
vb.put(0f); vb.put(0f); vb.put(0f);
@@ -48,7 +48,7 @@ public class PerfUniLoad extends PerfModule {
}
vertices.seal(gl, true);
- GLArrayDataServer colors = GLArrayDataServer.createGLSL("mgl_Color", 4, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ GLArrayDataServer colors = GLArrayDataServer.createGLSL(gl, "mgl_Color", 4, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
{
FloatBuffer cb = (FloatBuffer)colors.getBuffer();
cb.put(0f); cb.put(0f); cb.put(0f); cb.put(1f);
diff --git a/src/demos/es2/perftst/PerfVBOLoad.java b/src/demos/es2/perftst/PerfVBOLoad.java
index 89578db..376ab0a 100755
--- a/src/demos/es2/perftst/PerfVBOLoad.java
+++ b/src/demos/es2/perftst/PerfVBOLoad.java
@@ -30,7 +30,7 @@ public class PerfVBOLoad extends PerfModule {
float r=1f, g=1f, b=1f;
for(int i=0; i<numObjs; i++) {
- vertices[i] = GLArrayDataServer.createGLSL("mgl_Vertex", 3, dataType, true, numVertices, GL.GL_STATIC_DRAW);
+ vertices[i] = GLArrayDataServer.createGLSL(gl, "mgl_Vertex", 3, dataType, true, numVertices, GL.GL_STATIC_DRAW);
vertices[i].setVBOUsage(useVBO);
{
Buffer verticeb = vertices[i].getBuffer();
@@ -44,7 +44,7 @@ public class PerfVBOLoad extends PerfModule {
if(y>1f) { x=0f; y=0f; z+=0.01f; }
}
}
- colors[i] = GLArrayDataServer.createGLSL("mgl_Color", 4, dataType, true, numVertices, GL.GL_STATIC_DRAW);
+ colors[i] = GLArrayDataServer.createGLSL(gl, "mgl_Color", 4, dataType, true, numVertices, GL.GL_STATIC_DRAW);
colors[i].setVBOUsage(useVBO);
{
// Fill them up
diff --git a/src/demos/es2/perftst/Perftst.java b/src/demos/es2/perftst/Perftst.java
index e6fa822..91c6711 100755
--- a/src/demos/es2/perftst/Perftst.java
+++ b/src/demos/es2/perftst/Perftst.java
@@ -43,9 +43,8 @@ public class Perftst implements MouseListener, GLEventListener {
int height = 480;
pmod = pm;
System.err.println("Perftst.run()");
- GLProfile.setProfileGL2ES2();
try {
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(GLProfile.GetProfileGL2ES2());
// For emulation library, use 16 bpp
caps.setRedBits(5);
caps.setGreenBits(6);
diff --git a/src/demos/gamma/TestGamma.java b/src/demos/gamma/TestGamma.java
index 1af60e4..6cc1801 100755
--- a/src/demos/gamma/TestGamma.java
+++ b/src/demos/gamma/TestGamma.java
@@ -43,26 +43,47 @@ import demos.gears.Gears;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+import javax.media.opengl.*;
import javax.media.opengl.awt.GLCanvas;
import com.sun.opengl.util.Animator;
import com.sun.opengl.util.Gamma;
-public class TestGamma {
+public class TestGamma implements GLEventListener {
private static void usage() {
System.out.println("Usage: java TestGamma [gamma value] [brightness value] [contrast value]");
System.exit(1);
}
+ public void init(GLAutoDrawable drawable) {
+ GL gl = drawable.getGL();
+ if (!Gamma.setDisplayGamma(gl, gamma, brightness, contrast)) {
+ System.err.println("Unable to change display gamma, brightness, and contrast");
+ }
+ System.err.println("init: Gamma.setDisplayGamma");
+ }
+
+ public void dispose(GLAutoDrawable drawable) {
+ GL gl = drawable.getGL();
+ Gamma.resetDisplayGamma(gl);
+ System.err.println("dispose: Gamma.resetDisplayGamma");
+ }
+
+ public void display(GLAutoDrawable drawable) {
+ }
+
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ }
+
+ public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
+ }
+
public static void main(String[] args) {
if (args.length != 3) {
usage();
}
- float gamma = 1.0f;
- float brightness = 0.0f;
- float contrast = 0.0f;
try {
gamma = Float.parseFloat(args[0]);
brightness = Float.parseFloat(args[1]);
@@ -74,6 +95,7 @@ public class TestGamma {
Frame frame = new Frame("Gear and Gamma Demo");
GLCanvas canvas = new GLCanvas();
canvas.addGLEventListener(new Gears());
+ canvas.addGLEventListener(new TestGamma());
frame.add(canvas);
frame.setSize(300, 300);
final Animator animator = new Animator(canvas);
@@ -85,7 +107,6 @@ public class TestGamma {
new Thread(new Runnable() {
public void run() {
animator.stop();
- Gamma.resetDisplayGamma();
System.exit(0);
}
}).start();
@@ -94,8 +115,9 @@ public class TestGamma {
frame.setVisible(true);
animator.start();
- if (!Gamma.setDisplayGamma(gamma, brightness, contrast)) {
- System.err.println("Unable to change display gamma, brightness, and contrast");
- }
}
+
+ static float gamma = 1.0f;
+ static float brightness = 0.0f;
+ static float contrast = 0.0f;
}
diff --git a/src/demos/gears/Gears.java b/src/demos/gears/Gears.java
index 2107014..aff336a 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 GLCapabilities: " + drawable.getGLCapabilities());
gl.setSwapInterval(1);
diff --git a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
index 23c9d86..1c7effe 100644
--- a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
+++ b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
@@ -270,17 +270,17 @@ public class HWShadowmapsSimple extends Demo {
gl.glEnable(GL2.GL_DEPTH_TEST);
// init pbuffer
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(gl.getGLProfile());
caps.setDoubleBuffered(false);
- if (!GLDrawableFactory.getFactory().canCreateGLPbuffer()) {
+ if (!GLDrawableFactory.getFactory(gl.getGLProfile()).canCreateGLPbuffer()) {
unavailableExtension("Can not create pbuffer");
}
if (pbuffer != null) {
pbuffer.destroy();
pbuffer = null;
}
- pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(caps, null, TEX_SIZE, TEX_SIZE, drawable.getContext());
+ pbuffer = GLDrawableFactory.getFactory(gl.getGLProfile()).createGLPbuffer(caps, null, TEX_SIZE, TEX_SIZE, drawable.getContext());
pbuffer.addGLEventListener(new PbufferListener());
doViewAll = true;
diff --git a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
index 47ee213..dde5135 100644
--- a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
+++ b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
@@ -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();
+ GLCapabilities caps = new GLCapabilities(null);
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 b0cd597..f2c248d 100755
--- a/src/demos/j2d/TestOverlay.java
+++ b/src/demos/j2d/TestOverlay.java
@@ -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();
+ GLCapabilities caps = new GLCapabilities(null);
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 835a2a9..2d88a2d 100755
--- a/src/demos/j2d/TestTextRenderer.java
+++ b/src/demos/j2d/TestTextRenderer.java
@@ -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();
+ GLCapabilities caps = new GLCapabilities(null);
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 a3f8723..9e57b3f 100755
--- a/src/demos/j2d/TestTextureRenderer.java
+++ b/src/demos/j2d/TestTextureRenderer.java
@@ -74,10 +74,9 @@ public class TestTextureRenderer implements GLEventListener {
public static void main(String[] args) {
Frame frame = new Frame("Java 2D Renderer Test");
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(GLProfile.GetProfile(GLProfile.GL2));
caps.setAlphaBits(8);
- GLProfile.setProfile("GL2");
GLCanvas canvas = new GLCanvas(caps);
canvas.addGLEventListener(new Gears());
canvas.addGLEventListener(new TestTextureRenderer());
diff --git a/src/demos/j2d/TextCube.java b/src/demos/j2d/TextCube.java
index 1ef3144..5719a8f 100755
--- a/src/demos/j2d/TextCube.java
+++ b/src/demos/j2d/TextCube.java
@@ -51,6 +51,8 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.geom.Rectangle2D;
import javax.media.opengl.GL;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
@@ -76,8 +78,8 @@ public class TextCube extends Demo {
Frame frame = new Frame("Text Cube");
frame.setLayout(new BorderLayout());
- GLProfile.setProfile("GL2");
- GLCanvas canvas = new GLCanvas();
+ GLCapabilities caps = new GLCapabilities(GLProfile.GetProfile(GLProfile.GL2));
+ GLCanvas canvas = new GLCanvas(caps);
final TextCube demo = new TextCube();
canvas.addGLEventListener(demo);
diff --git a/src/demos/j2d/TextFlow.java b/src/demos/j2d/TextFlow.java
index 91951e0..52542c6 100755
--- a/src/demos/j2d/TextFlow.java
+++ b/src/demos/j2d/TextFlow.java
@@ -58,6 +58,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.media.opengl.GL;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
@@ -78,8 +80,8 @@ public class TextFlow extends Demo {
Frame frame = new Frame("Text Flow");
frame.setLayout(new BorderLayout());
- GLProfile.setProfile("GL2");
- GLCanvas canvas = new GLCanvas();
+ GLCapabilities caps = new GLCapabilities(GLProfile.GetProfile(GLProfile.GL2));
+ GLCanvas canvas = new GLCanvas(caps);
final TextFlow demo = new TextFlow();
canvas.addGLEventListener(demo);
diff --git a/src/demos/jgears/JGears.java b/src/demos/jgears/JGears.java
index 66c036d..5ba25bc 100644
--- a/src/demos/jgears/JGears.java
+++ b/src/demos/jgears/JGears.java
@@ -19,6 +19,7 @@ import java.io.InputStream;
import java.text.DecimalFormat;
import javax.imageio.ImageIO;
import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLJPanel;
import com.sun.opengl.util.Animator;
import javax.swing.JCheckBox;
@@ -43,7 +44,7 @@ public class JGears extends GLJPanel {
private BufferedImage openglImage;
static {
- caps = new GLCapabilities();
+ caps = new GLCapabilities(GLProfile.GetProfile(GLProfile.GL2));
caps.setAlphaBits(8);
}
diff --git a/src/demos/jrefract/JRefract.java b/src/demos/jrefract/JRefract.java
index d625b43..cf8aa0f 100755
--- a/src/demos/jrefract/JRefract.java
+++ b/src/demos/jrefract/JRefract.java
@@ -57,6 +57,7 @@ import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLJPanel;
import com.sun.opengl.util.Animator;
import com.sun.opengl.util.FPSAnimator;
@@ -135,7 +136,7 @@ public class JRefract {
inner.setClosable(true);
inner.setVisible(true);
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(GLProfile.GetProfile(GLProfile.GL2));
if (which == INFINITE) {
caps.setStencilBits(16);
}
diff --git a/src/demos/misc/GLCapsTableDemo.java b/src/demos/misc/GLCapsTableDemo.java
index 412954c..bc77c0b 100755
--- a/src/demos/misc/GLCapsTableDemo.java
+++ b/src/demos/misc/GLCapsTableDemo.java
@@ -178,7 +178,7 @@ public class GLCapsTableDemo
pane2 = new JPanel();
// Hack: use multisampled capabilities to pick up more detailed information on Windows
- GLCapabilities multisampledCaps = new GLCapabilities();
+ GLCapabilities multisampledCaps = new GLCapabilities(null);
multisampledCaps.setSampleBuffers(true);
canvas = new GLCanvas(multisampledCaps, choiceExaminer, null, device);
diff --git a/src/demos/misc/Picking.java b/src/demos/misc/Picking.java
index 2d52937..fde486c 100755
--- a/src/demos/misc/Picking.java
+++ b/src/demos/misc/Picking.java
@@ -30,8 +30,8 @@ public class Picking
Picking()
{
Frame frame = new Frame("Picking Example");
- GLDrawableFactory factory = GLDrawableFactory.getFactory();
- GLCapabilities capabilities = new GLCapabilities();
+ GLCapabilities capabilities = new GLCapabilities(null);
+ GLDrawableFactory factory = GLDrawableFactory.getFactory(capabilities.getGLProfile());
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..a5034fa 100755
--- a/src/demos/misc/TiledRendering.java
+++ b/src/demos/misc/TiledRendering.java
@@ -38,15 +38,16 @@ public class TiledRendering {
String filename = args[0];
File file = new File(filename);
- if (!GLDrawableFactory.getFactory().canCreateGLPbuffer()) {
+ GLCapabilities caps = new GLCapabilities(null);
+ caps.setDoubleBuffered(false);
+
+ if (!GLDrawableFactory.getFactory(caps.getGLProfile()).canCreateGLPbuffer()) {
System.out.println("Demo requires pbuffer support");
System.exit(1);
}
// Use a pbuffer for rendering
- GLCapabilities caps = new GLCapabilities();
- caps.setDoubleBuffered(false);
- GLPbuffer pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(caps, null,
+ GLPbuffer pbuffer = GLDrawableFactory.getFactory(caps.getGLProfile()).createGLPbuffer(caps, null,
256, 256,
null);
diff --git a/src/demos/multisample/Multisample.java b/src/demos/multisample/Multisample.java
index ee80d5e..1c3c9ab 100755
--- a/src/demos/multisample/Multisample.java
+++ b/src/demos/multisample/Multisample.java
@@ -77,7 +77,7 @@ public class Multisample {
}
public void run(String[] args) {
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(null);
GLCapabilitiesChooser chooser = new MultisampleChooser();
caps.setSampleBuffers(true);
diff --git a/src/demos/particles/engine/GLComponent.java b/src/demos/particles/engine/GLComponent.java
index f64953d..43c3501 100755
--- a/src/demos/particles/engine/GLComponent.java
+++ b/src/demos/particles/engine/GLComponent.java
@@ -63,7 +63,7 @@ public class GLComponent extends GLCanvas implements GLEventListener {
}
private static GLCapabilities getCapabilities() {
- GLCapabilities caps = new GLCapabilities();
+ GLCapabilities caps = new GLCapabilities(null);
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
return caps;
diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java
index d2c068f..a5df90c 100644
--- a/src/demos/proceduralTexturePhysics/Water.java
+++ b/src/demos/proceduralTexturePhysics/Water.java
@@ -213,12 +213,12 @@ 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();
+ GLCapabilities caps = parentWindow.getGLCapabilities();
caps.setDoubleBuffered(false);
- if (!GLDrawableFactory.getFactory().canCreateGLPbuffer()) {
+ if (!GLDrawableFactory.getFactory(caps.getGLProfile()).canCreateGLPbuffer()) {
throw new GLException("Pbuffers not supported with this graphics card");
}
- pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(caps,
+ pbuffer = GLDrawableFactory.getFactory(caps.getGLProfile()).createGLPbuffer(caps,
null,
initialMapDimensions[0],
initialMapDimensions[1],
diff --git a/src/demos/texture/TextureConvert.java b/src/demos/texture/TextureConvert.java
index 13180fc..8df6848 100755
--- a/src/demos/texture/TextureConvert.java
+++ b/src/demos/texture/TextureConvert.java
@@ -69,14 +69,15 @@ public class TextureConvert {
String inputFile = args[0];
String outputFile = args[1];
+ GLCapabilities caps = new GLCapabilities(null);
+ caps.setDoubleBuffered(false);
+
// Make a pbuffer to get an offscreen context
- if (!GLDrawableFactory.getFactory().canCreateGLPbuffer()) {
+ if (!GLDrawableFactory.getFactory(caps).canCreateGLPbuffer()) {
System.out.println("Pbuffer support not available (required to run this demo)");
System.exit(1);
}
- GLCapabilities caps = new GLCapabilities();
- caps.setDoubleBuffered(false);
- GLPbuffer pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(caps, null, 2, 2, null);
+ GLPbuffer pbuffer = GLDrawableFactory.getFactory(caps).createGLPbuffer(caps, null, 2, 2, null);
pbuffer.getContext().makeCurrent();
GL gl = pbuffer.getGL();
diff --git a/src/demos/vertexBufferObject/VertexBufferObject.java b/src/demos/vertexBufferObject/VertexBufferObject.java
index 2082bea..5bd6de6 100644
--- a/src/demos/vertexBufferObject/VertexBufferObject.java
+++ b/src/demos/vertexBufferObject/VertexBufferObject.java
@@ -47,6 +47,8 @@ import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import javax.media.opengl.GL;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
@@ -100,8 +102,8 @@ public class VertexBufferObject extends Demo {
usage();
}
}
- GLProfile.setProfile("GL2");
- GLCanvas canvas = new GLCanvas();
+ GLCapabilities caps = new GLCapabilities(GLProfile.GetProfile(GLProfile.GL2));
+ GLCanvas canvas = new GLCanvas(caps);
VertexBufferObject demo = new VertexBufferObject();
demo.vboEnabled = vboEnabled;
canvas.addGLEventListener(demo);
diff --git a/src/demos/xtrans/XTDesktopManager.java b/src/demos/xtrans/XTDesktopManager.java
index 446b6ee..2771107 100755
--- a/src/demos/xtrans/XTDesktopManager.java
+++ b/src/demos/xtrans/XTDesktopManager.java
@@ -51,6 +51,7 @@ import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLProfile;
import javax.swing.JDesktopPane;
@@ -116,7 +117,8 @@ public class XTDesktopManager extends OffscreenDesktopManager {
// Get valid Java2D context
if (j2dContext == null ||
j2dContextSurfaceIdentifier != Java2D.getOGLSurfaceIdentifier(g)) {
- j2dContext = GLDrawableFactory.getFactory().createExternalGLContext();
+ GLProfile glp = GLProfile.GetProfileDefault();
+ j2dContext = GLDrawableFactory.getFactory(glp).createExternalGLContext();
j2dContext.setGL(new DebugGL2(j2dContext.getGL().getGL2()));
j2dContextSurfaceIdentifier = Java2D.getOGLSurfaceIdentifier(g);
}
diff --git a/src/demos/xtrans/XTDesktopPane.java b/src/demos/xtrans/XTDesktopPane.java
index 7294376..1c349b7 100755
--- a/src/demos/xtrans/XTDesktopPane.java
+++ b/src/demos/xtrans/XTDesktopPane.java
@@ -49,6 +49,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import javax.media.opengl.DebugGL2;
import javax.media.opengl.GL;
+import javax.media.opengl.GLProfile;
import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLContext;
@@ -99,6 +100,7 @@ public class XTDesktopPane extends OffscreenDesktopPane {
private int textureTarget = GL.GL_TEXTURE_2D;
private GLU glu = new GLU();
+ private GLProfile glProfile = GLProfile.GetProfileDefault();
/** Creates a new accelerated transition desktop pane. */
public XTDesktopPane() {
@@ -187,7 +189,8 @@ public class XTDesktopPane extends OffscreenDesktopPane {
// Get valid Java2D context
if (j2dContext == null ||
j2dContextSurfaceIdentifier != Java2D.getOGLSurfaceIdentifier(g)) {
- j2dContext = GLDrawableFactory.getFactory().createExternalGLContext();
+
+ j2dContext = GLDrawableFactory.getFactory(glProfile).createExternalGLContext();
j2dContext.setGL(new DebugGL2(j2dContext.getGL().getGL2()));
j2dContextSurfaceIdentifier = Java2D.getOGLSurfaceIdentifier(g);
}