diff options
author | Sven Gothel <[email protected]> | 2009-03-05 01:23:34 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-03-05 01:23:34 +0000 |
commit | 6833b2827d31a7bf08e22963b0d44be6470bdf07 (patch) | |
tree | 0a4db7776d9a1489d2bec772227a6410eeb62cf6 /src/classes/javax/media/opengl/util/ImmModeSink.java | |
parent | 8e2154eebe45e2f5fd6b0c6598a26ef16617e425 (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/branches/JOGL_2_SANDBOX@1856 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/javax/media/opengl/util/ImmModeSink.java')
-rw-r--r-- | src/classes/javax/media/opengl/util/ImmModeSink.java | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/src/classes/javax/media/opengl/util/ImmModeSink.java b/src/classes/javax/media/opengl/util/ImmModeSink.java index 526f38dab..9ab899d69 100644 --- a/src/classes/javax/media/opengl/util/ImmModeSink.java +++ b/src/classes/javax/media/opengl/util/ImmModeSink.java @@ -2,6 +2,8 @@ package javax.media.opengl.util; import javax.media.opengl.*; +import javax.media.opengl.sub.*; +import javax.media.opengl.sub.fixed.*; import com.sun.opengl.impl.GLReflection; import java.nio.*; import java.util.Iterator; @@ -332,8 +334,13 @@ public class ImmModeSink { enableBuffer(gl, true); if (buffer!=null) { + GLFixedFuncIf glf = GLFixedFuncUtil.getGLFixedFuncIf(gl); + if(null==glf) { + throw new GLException("ImmModeSink.draw: No GLFixedFuncIf available"); + } + if(null==indices) { - gl.glDrawArrays(mode, 0, count); + glf.glDrawArrays(mode, 0, count); } else { Class clazz = indices.getClass(); int type=-1; @@ -345,7 +352,7 @@ public class ImmModeSink { if(0>type) { throw new GLException("Given Buffer Class not supported: "+clazz+", should be ubyte or ushort:\n\t"+this); } - gl.glDrawElements(mode, indices.remaining(), type, indices); + glf.glDrawElements(mode, indices.remaining(), type, indices); // GL2: gl.glDrawRangeElements(mode, 0, indices.remaining()-1, indices.remaining(), type, indices); } } @@ -643,11 +650,12 @@ public class ImmModeSink { this.bufferWritten=false; } - public void seal(GL gl, boolean seal) + public void seal(GL glObj, boolean seal) { seal(seal); if(sealedGL==seal) return; sealedGL = seal; + GL gl = glObj.getGL(); if(seal) { if(vboUsage && vboName==0) { int[] tmp = new int[1]; @@ -695,6 +703,11 @@ public class ImmModeSink { } public void enableBufferFixed(GL gl, boolean enable) { + GLFixedFuncIf glf = GLFixedFuncUtil.getGLFixedFuncIf(gl); + if(null==glf) { + throw new GLException("ImmModeSink.enableBufferFixed: No GLFixedFuncIf available"); + } + if(enable) { gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboName); @@ -704,35 +717,35 @@ public class ImmModeSink { } if(vComps>0) { - gl.glEnableClientState(gl.GL_VERTEX_ARRAY); - gl.glVertexPointer(vArrayData); + glf.glEnableClientState(glf.GL_VERTEX_ARRAY); + glf.glVertexPointer(vArrayData); } if(cComps>0) { - gl.glEnableClientState(gl.GL_COLOR_ARRAY); - gl.glColorPointer(cArrayData); + glf.glEnableClientState(glf.GL_COLOR_ARRAY); + glf.glColorPointer(cArrayData); } if(nComps>0) { - gl.glEnableClientState(gl.GL_NORMAL_ARRAY); - gl.glNormalPointer(nArrayData); + glf.glEnableClientState(glf.GL_NORMAL_ARRAY); + glf.glNormalPointer(nArrayData); } if(tComps>0) { - gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY); - gl.glTexCoordPointer(tArrayData); + glf.glEnableClientState(glf.GL_TEXTURE_COORD_ARRAY); + glf.glTexCoordPointer(tArrayData); } gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); } else { if(vComps>0) { - gl.glDisableClientState(gl.GL_VERTEX_ARRAY); + glf.glDisableClientState(glf.GL_VERTEX_ARRAY); } if(cComps>0) { - gl.glDisableClientState(gl.GL_COLOR_ARRAY); + glf.glDisableClientState(glf.GL_COLOR_ARRAY); } if(nComps>0) { - gl.glDisableClientState(gl.GL_NORMAL_ARRAY); + glf.glDisableClientState(glf.GL_NORMAL_ARRAY); } if(tComps>0) { - gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY); + glf.glDisableClientState(glf.GL_TEXTURE_COORD_ARRAY); } } } @@ -745,10 +758,10 @@ public class ImmModeSink { } if(enable) { - gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboName); + glsl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboName); if(!bufferWritten) { - gl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit(), buffer, GL.GL_STATIC_DRAW); + glsl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit(), buffer, GL.GL_STATIC_DRAW); bufferWritten=true; } @@ -769,7 +782,7 @@ public class ImmModeSink { st.glVertexAttribPointer(glsl, tArrayData); } - gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); + glsl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); } else { if(vComps>0) { st.glDisableVertexAttribArray(glsl, vArrayData.getName()); @@ -853,25 +866,25 @@ public class ImmModeSink { buffer.flip(); if(vComps>0) { - vArrayData = GLArrayDataWrapper.createFixed(GL.GL_VERTEX_ARRAY, vComps, vDataType, false, + vArrayData = GLArrayDataWrapper.createFixed(GLPointerIf.GL_VERTEX_ARRAY, vComps, vDataType, false, 0, vertexArray, 0, vOffset); } else { vArrayData = null; } if(cComps>0) { - cArrayData = GLArrayDataWrapper.createFixed(GL.GL_COLOR_ARRAY, cComps, cDataType, false, + cArrayData = GLArrayDataWrapper.createFixed(GLPointerIf.GL_COLOR_ARRAY, cComps, cDataType, false, 0, colorArray, 0, cOffset); } else { cArrayData = null; } if(nComps>0) { - nArrayData = GLArrayDataWrapper.createFixed(GL.GL_NORMAL_ARRAY, nComps, nDataType, false, + nArrayData = GLArrayDataWrapper.createFixed(GLPointerIf.GL_NORMAL_ARRAY, nComps, nDataType, false, 0, normalArray, 0, nOffset); } else { nArrayData = null; } if(tComps>0) { - tArrayData = GLArrayDataWrapper.createFixed(GL.GL_TEXTURE_COORD_ARRAY, tComps, tDataType, false, + tArrayData = GLArrayDataWrapper.createFixed(GLPointerIf.GL_TEXTURE_COORD_ARRAY, tComps, tDataType, false, 0, textCoordArray, 0, tOffset); } else { tArrayData = null; |