diff options
author | Sven Gothel <[email protected]> | 2023-03-19 07:08:51 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-19 07:08:51 +0100 |
commit | 535680eadef89078e6fc62adff21ec9923c968a3 (patch) | |
tree | 9baf359b765021045cacde160892454bc62bb0a1 /src/jogl/classes/com/jogamp/graph | |
parent | c0fcaf04b042f8337c90116c98c833ff4a356e1c (diff) |
Graph: GLRegion: Pass curRenderModes to updateImpl() + drawImpl(), prepare switch by sampleCount; Don't use any resource not requested by curRenderModes
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java | 12 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java | 8 |
2 files changed, 12 insertions, 8 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 2ffa68be6..46406cf96 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java @@ -176,8 +176,9 @@ public abstract class GLRegion extends Region { * objects for use in rendering if {@link #isShapeDirty()}.
* <p>Allocates the ogl related data and initializes it the 1st time.<p>
* <p>Called by {@link #draw(GL2ES2, RenderState, int, int, int)}.</p>
+ * @param curRenderModes TODO
*/
- protected abstract void updateImpl(final GL2ES2 gl);
+ protected abstract void updateImpl(final GL2ES2 gl, int curRenderModes);
protected abstract void destroyImpl(final GL2ES2 gl);
@@ -248,17 +249,18 @@ public abstract class GLRegion extends Region { * </p>
* @param matrix current {@link PMVMatrix}.
* @param renderer the {@link RegionRenderer} to be used
- * @param sampleCount desired multisampling sample count for msaa-rendering.
+ * @param sampleCount desired multisampling sample count for vbaa- or msaa-rendering.
* 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();
if( isShapeDirty() ) {
- updateImpl(gl);
+ updateImpl(gl, curRenderModes);
}
- drawImpl(gl, renderer, sampleCount);
+ drawImpl(gl, renderer, curRenderModes, sampleCount);
clearDirtyBits(DIRTY_SHAPE|DIRTY_STATE);
}
- protected abstract void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int[/*1*/] sampleCount);
+ protected abstract void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, int curRenderModes, final int[/*1*/] sampleCount);
}
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 e2674fbe0..3c14b1bab 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -521,7 +521,9 @@ public final class RegionRenderer { final ShaderModeSelector1 sel1 = pass1 ? ShaderModeSelector1.selectPass1(renderModes) : ShaderModeSelector1.selectPass2(renderModes, quality, sampleCount); final boolean isTwoPass = Region.isTwoPass( renderModes ); - final boolean isPass1ColorTexSeq = pass1 && null != colorTexSeq; + final boolean hasColorChannel = Region.hasColorChannel( renderModes ); + final boolean hasColorTexture = Region.hasColorTexture( renderModes ) && null != colorTexSeq; + final boolean isPass1ColorTexSeq = pass1 && hasColorTexture; final int colorTexSeqHash; final String texLookupFuncName; if( isPass1ColorTexSeq ) { @@ -601,11 +603,11 @@ public final class RegionRenderer { // GLSL append from here on posFp = -1; - if( Region.hasColorChannel( renderModes ) ) { + if( hasColorChannel ) { posVp = rsVp.insertShaderSource(0, posVp, GLSL_USE_COLOR_CHANNEL); posFp = rsFp.insertShaderSource(0, posFp, GLSL_USE_COLOR_CHANNEL); } - if( Region.hasColorTexture( renderModes ) ) { + if( isPass1ColorTexSeq ) { rsVp.insertShaderSource(0, posVp, GLSL_USE_COLOR_TEXTURE); posFp = rsFp.insertShaderSource(0, posFp, GLSL_USE_COLOR_TEXTURE); } |