aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-03-19 07:14:01 +0100
committerSven Gothel <[email protected]>2023-03-19 07:14:01 +0100
commita6b57c0a3751f37b425e0bd69155d3dbab7e147c (patch)
treef2c080610e543b5c1976c3b49b74e7b92c101e1e /src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
parent535680eadef89078e6fc62adff21ec9923c968a3 (diff)
Graph: GLRegion.draw(): Mod curRenderModes by sampleCount { 0 = no-sampling, -1 = glSelect } (Experimental not working fully)
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
index 46406cf96..aca5fca52 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
@@ -207,6 +207,7 @@ public abstract class GLRegion extends Region {
* @see GLArrayDataEditable#clear(GL)
*/
public GLRegion clear(final GL2ES2 gl) {
+ lastRenderModes = 0;
clearImpl(gl);
clearImpl();
return this;
@@ -250,17 +251,34 @@ public abstract class GLRegion extends Region {
* @param matrix current {@link PMVMatrix}.
* @param renderer the {@link RegionRenderer} to be used
* @param sampleCount desired multisampling sample count for vbaa- or msaa-rendering.
+ * Use -1 for glSelect mode, pass1 w/o any color texture nor channel, use static select color only.
* The actual used scample-count is written back when msaa-rendering is enabled, otherwise the store is untouched.
* @see RegionRenderer#enable(GL2ES2, boolean)
*/
public final void draw(final GL2ES2 gl, final RegionRenderer renderer, final int[/*1*/] sampleCount) {
- final int curRenderModes = getRenderModes();
+ final int curRenderModes;
+ if( null == sampleCount || 0 == sampleCount[0] ) {
+ // no sampling, reduce to pass1
+ curRenderModes = getRenderModes() & ~( VBAA_RENDERING_BIT | MSAA_RENDERING_BIT );
+ } else if( 0 > sampleCount[0] ) {
+ // negative sampling, hint we perform glSelect: pass1 w/o any color texture nor channel, use static select color only
+ curRenderModes = getRenderModes() & ~( VBAA_RENDERING_BIT | MSAA_RENDERING_BIT | COLORCHANNEL_RENDERING_BIT | COLORTEXTURE_RENDERING_BIT );
+ } else {
+ // normal 2-pass sampling
+ curRenderModes = getRenderModes();
+ }
+ if( lastRenderModes != curRenderModes ) {
+ markShapeDirty();
+ markStateDirty();
+ }
if( isShapeDirty() ) {
updateImpl(gl, curRenderModes);
}
drawImpl(gl, renderer, curRenderModes, sampleCount);
clearDirtyBits(DIRTY_SHAPE|DIRTY_STATE);
+ lastRenderModes = curRenderModes;
}
+ private int lastRenderModes = 0;
protected abstract void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, int curRenderModes, final int[/*1*/] sampleCount);
}