diff options
author | Sven Gothel <[email protected]> | 2012-10-16 06:27:40 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-16 06:27:40 +0200 |
commit | 658d269db957cdb986f2da2fbe15d2441b6f03c4 (patch) | |
tree | d5b5d86f18f67368eb0997d31605e3b3a80c8b5c /src/jogl/classes/jogamp | |
parent | f8fb65c7cd79743a6501fe63ff1e28479ceedb4f (diff) |
ImmModeSink: Fix buffer grow (+1 element @ named buffer), enable DEBUG_* via properties, drawIndices QUAD w/ proper range and add uint; FixedFunctionHook: drawIndices QUAD w/ proper range and add uint
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java index 77b7a16b7..814d7f519 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java @@ -138,20 +138,27 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun public void glDrawElements(int mode, int count, int type, java.nio.Buffer indices) { fixedFunction.validate(gl); if ( GL2.GL_QUADS == mode && !gl.isGL2() ) { + final int idx0 = indices.position(); + if( GL.GL_UNSIGNED_BYTE == type ) { final ByteBuffer b = (ByteBuffer) indices; - for (int j = b.position(); j < count; j++) { - gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x000000ff & b.get(j)), 4); + for (int j = 0; j < count; j++) { + gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x000000ff & b.get(idx0+j)), 4); } - } else { + } else if( GL.GL_UNSIGNED_SHORT == type ){ final ShortBuffer b = (ShortBuffer) indices; - for (int j = b.position(); j < count; j++) { - gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x0000ffff & b.get(j)), 4); + for (int j = 0; j < count; j++) { + gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x0000ffff & b.get(idx0+j)), 4); + } + } else { + final IntBuffer b = (IntBuffer) indices; + for (int j = 0; j < count; j++) { + gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0xffffffff & b.get(idx0+j)), 4); } } } else { gl.glDrawElements(mode, count, type, indices); - // GL2: gl.glDrawRangeElements(mode, 0, count-1, indices.remaining(), type, indices); + // GL2: gl.glDrawRangeElements(mode, 0, count-1, count, type, indices); } } public void glDrawElements(int mode, int count, int type, long indices_buffer_offset) { |