diff options
author | Sven Gothel <[email protected]> | 2009-03-05 01:25:12 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-03-05 01:25:12 +0000 |
commit | e03aaaf1b14cc40cb2c8f2158acf02390c4fafe6 (patch) | |
tree | cf7eacef23ee86b7e1dfddd69800eaa303ce399b /src/demos/es1/cube/Cube.java | |
parent | 612955ad82326024f5cb99d9fe4175dce78caa27 (diff) |
- Fixed rootrel.build usage, this works properly through gluegen, jogl-demos and this build.
You can say -Drootrel.build=build-x86_64 for example.
- Fixed jogl-demos in regard to this changeset
- Gluegen
- Fixed gluegen BuildComposablePipeline's 'getGL*' methods.
Now they return 'this', otherwise the pipeline would be broken/removed.
- Add BuildComposablePipeline CustomPipeline, which allows customized
class composition with an interface (to be wrapped),
prolog class and the downstream class.
- Add GlueGen (incl. ant task) 'outputRootDir' to be able to set a
top output root dir via ant / commandline.
- GL fixed function
- Package 'javax.media.opengl.sub.fixed.*' defines some fixed function interfaces.
This allows partitioning of custom implementation.
- Using gluegen's new CustomPipeline to compose a GLFixedFuncIf implementation,
using a GL downstream and a GLFixedFuncHookIf prolog.
The latter implements the fixed functionality.
Example is the GLFixedFuncImpl.
gl.getContext().setGL( new GLFixedFuncImpl(gl, new FixedFuncHook(gl.getGL2ES2())) ) ;
or
gl.getContext().setGL( new GLFixedFuncImpl(gl, gl.getGL2ES1()) ) ;
- The example GLFixedFuncHookIf impl FixedFuncPipeline/
can be instantiated with custom shader code.
- ES2 and all other interfaces only contain the original functionality,
besides minor convenient data access methods.
- Fix: GL2ES2 createCompileShader() and createLoadShader() is moved to ShaderCode util class.
- Updated PMVMatrix
- Add: GLAutoDrawable.setContext() .. and all it's implementations
Necessary to set a new GLContext.
- Add: GLContext getAttachedObject(int) and putAttachedObject(int, Object),
to allow the user to attach application specific and TLS sensitive objects to the GLContext.
-
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@316 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos/es1/cube/Cube.java')
-rw-r--r-- | src/demos/es1/cube/Cube.java | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/src/demos/es1/cube/Cube.java b/src/demos/es1/cube/Cube.java index b77c4e9..63bea14 100644 --- a/src/demos/es1/cube/Cube.java +++ b/src/demos/es1/cube/Cube.java @@ -31,10 +31,13 @@ */ package demos.es1.cube; +import java.nio.*; import javax.media.opengl.*; +import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; import javax.media.opengl.glu.*; -import java.nio.*; +import com.sun.opengl.util.glsl.fixed.*; +import com.sun.opengl.impl.fixed.GLFixedFuncImpl; import com.sun.javafx.newt.*; @@ -71,13 +74,23 @@ public class Cube implements GLEventListener { } public void init(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); - glu = GLU.createGLU(); - if(gl.isGLES2()) { - gl.getGLES2().enableFixedFunctionEmulationMode(GLES2.FIXED_EMULATION_VERTEXCOLORTEXTURE); - System.err.println("Cubes Fixed emu: FIXED_EMULATION_VERTEXCOLORTEXTURE"); + GLFixedFuncIf gl; + { + GL _gl = drawable.getGL(); + if(!GLFixedFuncUtil.isGLFixedFuncIf(_gl)) { + if(_gl.isGLES2()) { + gl = new GLFixedFuncImpl(_gl, new FixedFuncHook(_gl.getGL2ES2())); + } else { + gl = new GLFixedFuncImpl(_gl, _gl.getGL2ES1()); + } + _gl.getContext().setGL(gl); + } else { + gl = GLFixedFuncUtil.getGLFixedFuncIf(_gl); + } } + glu = GLU.createGLU(); + gl.glGenBuffers(4, vboNames, 0); if(!innerCube) { @@ -87,16 +100,17 @@ public class Cube implements GLEventListener { 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("GLF:" + gl); } } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { float aspect = (height != 0) ? ((float)width / (float)height) : 1.0f; - GL gl = drawable.getGL(); - GL2ES1 glF=null; + GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); + GL2ES1 gl2es1=null; if(gl.isGL2ES1()) { - glF = drawable.getGL().getGL2ES1(); + gl2es1 = drawable.getGL().getGL2ES1(); } gl.glViewport(0, 0, width, height); @@ -128,11 +142,11 @@ public class Cube implements GLEventListener { gl.glDisable(gl.GL_LIGHT0); } gl.glEnable(gl.GL_CULL_FACE); - if(null!=glF) { + if(null!=gl2es1) { gl.glEnable(gl.GL_NORMALIZE); gl.glShadeModel(gl.GL_SMOOTH); - gl.glDisable(gl.GL_DITHER); + gl.glDisable(GL.GL_DITHER); } gl.glEnableClientState(gl.GL_VERTEX_ARRAY); @@ -155,16 +169,16 @@ public class Cube implements GLEventListener { gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboNames[3]); gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeTexCoords.limit() * BufferUtil.SIZEOF_SHORT, cubeTexCoords, GL.GL_STATIC_DRAW); gl.glTexCoordPointer(2, gl.GL_SHORT, 0, 0); - if(null!=glF) { - glF.glTexEnvi(glF.GL_TEXTURE_ENV, glF.GL_TEXTURE_ENV_MODE, glF.GL_INCR); + if(null!=gl2es1) { + gl2es1.glTexEnvi(gl2es1.GL_TEXTURE_ENV, gl2es1.GL_TEXTURE_ENV_MODE, gl2es1.GL_INCR); } } else { gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY); } gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); - if(null!=glF) { - glF.glHint(glF.GL_PERSPECTIVE_CORRECTION_HINT, glF.GL_FASTEST); + if(null!=gl2es1) { + gl2es1.glHint(gl2es1.GL_PERSPECTIVE_CORRECTION_HINT, gl2es1.GL_FASTEST); } gl.glMatrixMode(gl.GL_PROJECTION); @@ -179,7 +193,7 @@ public class Cube implements GLEventListener { } public void display(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT); |