aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/scripts/tests.sh4
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java46
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java2
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java3
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp2
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp2
6 files changed, 44 insertions, 15 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 8c0effbd2..9699a9ece 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -1007,7 +1007,7 @@ function testawtswt() {
#
#testnoawt com.jogamp.opengl.demos.graph.GPUTextNewtDemo $*
#testnoawt com.jogamp.opengl.demos.graph.GPURegionNewtDemo $*
-#testnoawt com.jogamp.opengl.demos.graph.ui.UIShapeClippingDemo00 $*
+testnoawt com.jogamp.opengl.demos.graph.ui.UIShapeClippingDemo00 $*
#testnoawt com.jogamp.opengl.demos.graph.ui.UIShapeDemo01 $*
#testnoawt com.jogamp.opengl.demos.graph.ui.UITypeDemo01 $*
@@ -1023,7 +1023,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.demos.av.MovieSimple $*
#testnoawt com.jogamp.opengl.demos.av.MovieCube $*
#testnoawt com.jogamp.opengl.demos.graph.ui.UIMediaGrid00 $*
-testnoawt com.jogamp.opengl.demos.graph.ui.UIMediaGrid01 $*
+#testnoawt com.jogamp.opengl.demos.graph.ui.UIMediaGrid01 $*
#testnoawt com.jogamp.opengl.demos.graph.ui.FontView01 $*
#testawt com.jogamp.opengl.demos.graph.ui.UISceneDemo20 $*
#testawt com.jogamp.opengl.demos.es2.GearsES2 $*
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java
index 08d771d8a..06917c182 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java
@@ -36,6 +36,7 @@ import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.ui.Shape;
import com.jogamp.graph.ui.shapes.Rectangle;
import com.jogamp.math.FloatUtil;
+import com.jogamp.math.geom.AABBox;
import com.jogamp.math.geom.plane.AffineTransform;
import com.jogamp.math.util.PMVMatrix4f;
import com.jogamp.newt.Window;
@@ -62,8 +63,9 @@ import com.jogamp.opengl.util.GLReadBufferUtil;
* Basic UIShape Clipping demo.
*
* Action Cursor-Keys:
- * - With Control: Move Left and Bottom Clipping Edge of AABBox
- * - No Modifiers: Move Right and Top Clipping Edge of AABBox
+ * - With Shift : Move the clipping-rectangle itself
+ * - With Control: Resize Left and Bottom Clipping Edge of AABBox
+ * - No Modifiers: Resize Right and Top Clipping Edge of AABBox
*/
public class UIShapeClippingDemo00 implements GLEventListener {
static final boolean DEBUG = false;
@@ -115,7 +117,10 @@ public class UIShapeClippingDemo00 implements GLEventListener {
final float w = clipRect.getWidth();
final float h = clipRect.getHeight();
if( keySym == KeyEvent.VK_LEFT ) {
- if( arg0.isControlDown() ) {
+ if( arg0.isShiftDown() ) {
+ final float d = w*more - w;
+ clipRect.move(-d, 0, 0);
+ } else if( arg0.isControlDown() ) {
final float d = w*more - w;
clipRect.setPosition(x-d, y, z);
clipRect.setDimension(w*more, h, clipRect.getLineWidth());
@@ -123,7 +128,10 @@ public class UIShapeClippingDemo00 implements GLEventListener {
clipRect.setDimension(w*less, h, clipRect.getLineWidth());
}
} else if( keySym == KeyEvent.VK_RIGHT ) {
- if( arg0.isControlDown() ) {
+ if( arg0.isShiftDown() ) {
+ final float d = w*more - w;
+ clipRect.move(d, 0, 0);
+ } else if( arg0.isControlDown() ) {
final float d = w - w*less;
clipRect.setPosition(x+d, y, z);
clipRect.setDimension(w*less, h, clipRect.getLineWidth());
@@ -131,7 +139,10 @@ public class UIShapeClippingDemo00 implements GLEventListener {
clipRect.setDimension(w*more, h, clipRect.getLineWidth());
}
} else if( keySym == KeyEvent.VK_UP ) {
- if( arg0.isControlDown() ) {
+ if( arg0.isShiftDown() ) {
+ final float d = h*more - h;
+ clipRect.move(0, d, 0);
+ } else if( arg0.isControlDown() ) {
final float d = h - h*less;
clipRect.setPosition(x, y+d, z);
clipRect.setDimension(w, h*less, clipRect.getLineWidth());
@@ -139,7 +150,10 @@ public class UIShapeClippingDemo00 implements GLEventListener {
clipRect.setDimension(w, h*more, clipRect.getLineWidth());
}
} else if( keySym == KeyEvent.VK_DOWN ) {
- if( arg0.isControlDown() ) {
+ if( arg0.isShiftDown() ) {
+ final float d = h*more - h;
+ clipRect.move(0, -d, 0);
+ } else if( arg0.isControlDown() ) {
final float d = h*more - h;
clipRect.setPosition(x, y-d, z);
clipRect.setDimension(w, h*more, clipRect.getLineWidth());
@@ -259,11 +273,21 @@ public class UIShapeClippingDemo00 implements GLEventListener {
renderer.enable(gl, true);
{
drawShape(gl, renderer, clipRect);
- renderer.setClipBBox(clipRect.getBounds());
- // System.err.println("Clipping "+renderer.getClipBBox());
- drawShape(gl, renderer, shape);
- // System.err.println("draw.0: "+shape);
- renderer.setClipBBox(null);
+ {
+ final AABBox clipBBox; // Mv pre-multiplied AABBox
+ {
+ final PMVMatrix4f pmv = renderer.getMatrix();
+ pmv.pushMv();
+ clipRect.setTransformMv(pmv);
+ clipBBox = clipRect.getBounds().transform(pmv.getMv(), new AABBox());
+ pmv.popMv();
+ }
+ renderer.setClipBBox( clipBBox );
+ // System.err.println("Clipping "+renderer.getClipBBox());
+ drawShape(gl, renderer, shape);
+ // System.err.println("draw.0: "+shape);
+ renderer.setClipBBox(null);
+ }
}
renderer.enable(gl, false);
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
index 06c10586c..c43dc7913 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -303,7 +303,9 @@ public final class RegionRenderer {
public final void setColorStatic(final float r, final float g, final float b, final float a){ rs.setColorStatic(r, g, b, a); }
+ /** Set the optional clipping {@link AABBox}, which shall be pre-multiplied with the Mv-matrix or null to disable. */
public final void setClipBBox(final AABBox clipBBox) { rs.setClipBBox(clipBBox); }
+ /** Returns the optional Mv-premultiplied clipping {@link AABBox} or null if unused. */
public final AABBox getClipBBox() { return rs.getClipBBox(); }
public final boolean isHintMaskSet(final int mask) { return rs.isHintMaskSet(mask); }
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
index 32483c1fc..ed4bc2585 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
@@ -98,6 +98,7 @@ public class RenderState {
private final FloatBuffer weightBuffer;
private final float[] colorStatic;
private final FloatBuffer colorStaticBuffer;
+ /** Optional clipping {@link AABBox}, which shall be pre-multiplied with the Mv-matrix. Null if unused. */
private AABBox clipBBox;
private int hintBitfield;
private ShaderProgram sp;
@@ -262,7 +263,9 @@ public class RenderState {
colorStatic[3] = a;
}
+ /** Set the optional clipping {@link AABBox}, which shall be pre-multiplied with the Mv-matrix or null to disable. */
public final void setClipBBox(final AABBox clipBBox) { this.clipBBox = clipBBox; }
+ /** Returns the optional Mv-premultiplied clipping {@link AABBox} or null if unused. */
public final AABBox getClipBBox() { return this.clipBBox; }
/**
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp
index 6956529f7..b9974b97d 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp
@@ -24,7 +24,7 @@ void main(void)
}
#endif
#ifdef USE_AABBOX_CLIPPING
- gcv_ClipBBoxCoord = gca_Vertices.xyz;
+ gcv_ClipBBoxCoord = (gcu_PMVMatrix02[1] * gca_Vertices).xyz; // Mv
#endif
#ifdef USE_COLOR_TEXTURE
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp
index aebf8c147..9518834b0 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp
@@ -24,7 +24,7 @@ void main(void)
}
#endif
#ifdef USE_AABBOX_CLIPPING
- gcv_ClipBBoxCoord = gca_Vertices.xyz;
+ gcv_ClipBBoxCoord = (gcu_PMVMatrix01[1] * gca_Vertices).xyz; // Mv
#endif
#ifdef USE_COLOR_TEXTURE