From 4c9083b0766ef94643d91102fb91a5f9e598a914 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 4 Oct 2012 03:31:18 +0200 Subject: Fix regression of commit a644d779ab19cb1d200ae4ba567b9c042c34b337, cannot compile FixedFuncHook due to removed 'isDirty()' - getModifiedBits() -> getModifiedBits(boolean clear) --- src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java | 15 +++++++++------ .../jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java | 2 +- .../opengl/test/junit/jogl/acore/TestPMVMatrix01NEWT.java | 10 +++++----- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java index eb4231533..686dd3895 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java +++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java @@ -933,19 +933,22 @@ public class PMVMatrix implements GLMatrixFunc { } /** - * Returns the modified bits due to mutable operations and clears it. + * Returns the modified bits due to mutable operations.. *

* A modified bit is set, if the corresponding matrix had been modified by a mutable operation - * since last {@link #update()} or {@link #getModifiedBits()} call. + * since last {@link #update()} or {@link #getModifiedBits(boolean) getModifiedBits(true)} call. *

+ * @param clear if true, clears the modified bits, otherwise leaves them untouched. * * @see #MODIFIED_PROJECTION * @see #MODIFIED_MODELVIEW * @see #MODIFIED_TEXTURE */ - public final int getModifiedBits() { + public final int getModifiedBits(boolean clear) { final int r = modifiedBits; - modifiedBits = 0; + if(clear) { + modifiedBits = 0; + } return r; } @@ -1024,7 +1027,7 @@ public class PMVMatrix implements GLMatrixFunc { * {@link #glGetMviMatrixf() Mvi get} or {@link #glGetMvitMatrixf() Mvit get} etc anymore. *

*

- * This method clears the modified bits like {@link #getModifiedBits()}, + * This method clears the modified bits like {@link #getModifiedBits(boolean) getModifiedBits(true)}, * which are set by any mutable operation. The modified bits have no impact * on this method, but the return value. *

@@ -1034,7 +1037,7 @@ public class PMVMatrix implements GLMatrixFunc { * In other words, method returns true if any matrix used by the caller must be updated, * e.g. uniforms in a shader program. * - * @see #getModifiedBits() + * @see #getModifiedBits(boolean) * @see #MODIFIED_PROJECTION * @see #MODIFIED_MODELVIEW * @see #MODIFIED_TEXTURE 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 897967f8b..804678fb4 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java @@ -341,7 +341,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun StringBuilder buf = new StringBuilder(); buf.append(getClass().getName()+" ("); if(null!=pmvMatrix) { - buf.append(", matrixDirty: "+pmvMatrix.isDirty()); + buf.append(", matrixDirty: "+ (0 != pmvMatrix.getModifiedBits(false))); } buf.append("\n\t, FixedFunction: "+fixedFunction); buf.append(gl); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPMVMatrix01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPMVMatrix01NEWT.java index 6c16cfcc1..18e9df5a0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPMVMatrix01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPMVMatrix01NEWT.java @@ -98,7 +98,7 @@ public class TestPMVMatrix01NEWT extends UITestCase { pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmv.glLoadIdentity(); } - Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits()); // clear & test + Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits()); Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask()); @@ -106,7 +106,7 @@ public class TestPMVMatrix01NEWT extends UITestCase { // Action #1 // pmv.glTranslatef(1f, 2f, 3f); // all dirty ! - Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits()); // clear & test + Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits()); Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask()); // System.err.println("P1: "+pmv.toString()); @@ -140,7 +140,7 @@ public class TestPMVMatrix01NEWT extends UITestCase { // Action #2 // pmv.glLoadIdentity(); // all dirty - Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits()); // clear & test + Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits()); Assert.assertEquals("Request bits Mvi and Mvit not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW, pmv.getRequestMask()); MiscUtils.assertFloatBufferEquals("P not identity, "+pmv.toString(), ident, p, epsilon); @@ -188,7 +188,7 @@ public class TestPMVMatrix01NEWT extends UITestCase { pmv.glLoadIdentity(); } // System.err.println("P0: "+pmv.toString()); - Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits()); // clear & test + Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits()); Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask()); // System.err.println("P1: "+pmv.toString()); @@ -217,7 +217,7 @@ public class TestPMVMatrix01NEWT extends UITestCase { // Action #1 // pmv.glTranslatef(1f, 2f, 3f); // all dirty ! - Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits()); // clear & test + Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits()); MiscUtils.assertFloatBufferEquals("P not identity, "+pmv.toString()+pmv.toString(), ident, p, epsilon); MiscUtils.assertFloatBufferEquals("Mv not translated123, "+pmv.toString()+pmv.toString(), translated123N, mv, epsilon); -- cgit v1.2.3