diff options
Diffstat (limited to 'src/demos/es1')
-rwxr-xr-x | src/demos/es1/Info.java | 5 | ||||
-rwxr-xr-x | src/demos/es1/RedSquare.java | 63 | ||||
-rwxr-xr-x | src/demos/es1/angeles/AngelesGL.java | 6 | ||||
-rwxr-xr-x | src/demos/es1/angeles/AngelesGLil.java | 6 | ||||
-rwxr-xr-x | src/demos/es1/angeles/Main.java | 3 | ||||
-rw-r--r-- | src/demos/es1/cube/Cube.java | 5 | ||||
-rw-r--r-- | src/demos/es1/cube/CubeImmModeSink.java | 7 | ||||
-rwxr-xr-x | src/demos/es1/cubefbo/Main.java | 3 |
8 files changed, 58 insertions, 40 deletions
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); |