diff options
author | Sven Gothel <[email protected]> | 2023-03-14 14:25:12 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-14 14:25:12 +0100 |
commit | 4089f4687c64668d8abe1fe998517ef005d5dc60 (patch) | |
tree | 892f17921ea97027765669fc77a60a5878279ade /src/jogl/classes/com/jogamp/graph | |
parent | 861125339541de2670950aa66a496643ca5cf029 (diff) |
Graph: RegionRenderer: Adopt to TextureSequence API Change: Use setTextureLookupFunctionName(..) before using hash and/or code.
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java | 17 |
1 files changed, 8 insertions, 9 deletions
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 6b661fd7b..8dba6dfac 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -431,16 +431,19 @@ public class RegionRenderer { */ public final boolean useShaderProgram(final GL2ES2 gl, final int renderModes, final boolean pass1, final int quality, final int sampleCount, final TextureSequence colorTexSeq) { + 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 int colorTexSeqHash; - if( null != colorTexSeq ) { + final String texLookupFuncName; + if( isPass1ColorTexSeq ) { + texLookupFuncName = colorTexSeq.setTextureLookupFunctionName(gcuTexture2D); colorTexSeqHash = colorTexSeq.getTextureFragmentShaderHashCode(); } else { + texLookupFuncName = null; colorTexSeqHash = 0; } - 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 int shaderKey = ( (colorTexSeqHash << 5) - colorTexSeqHash ) + ( sel1.ordinal() | ( HIGH_MASK & renderModes ) | ( isTwoPass ? TWO_PASS_BIT : 0 ) ); @@ -534,13 +537,9 @@ public class RegionRenderer { throw new RuntimeException("Failed to read: includes"); } - final String texLookupFuncName; if( isPass1ColorTexSeq ) { posFp = rsFp.insertShaderSource(0, posFp, "uniform "+colorTexSeq.getTextureSampler2DType()+" "+UniformNames.gcu_ColorTexUnit+";\n"); - texLookupFuncName = colorTexSeq.getTextureLookupFunctionName(gcuTexture2D); posFp = rsFp.insertShaderSource(0, posFp, colorTexSeq.getTextureLookupFragmentShaderImpl()); - } else { - texLookupFuncName = null; } posFp = rsFp.insertShaderSource(0, posFp, GLSL_MAIN_BEGIN); |