diff options
Diffstat (limited to 'src/jogl/classes/jogamp')
3 files changed, 47 insertions, 49 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java index e3d2b8629..ae4a734be 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java @@ -176,12 +176,10 @@ public final class VBORegion2PMSAAES2 extends GLRegion { * * @param gl * @param renderer - * @param renderModes * @param pass1 - * @param pass2Quality - * @param sampleCount + * @param renderModes */ - public void useShaderProgram(final GL2ES2 gl, final RegionRenderer renderer, final int curRenderModes, final boolean pass1, final int pass2Quality, final int sampleCount) { + public void useShaderProgram(final GL2ES2 gl, final RegionRenderer renderer, final int curRenderModes, final boolean pass1) { final boolean isTwoPass = Region.isTwoPass( curRenderModes ); final boolean hasColorChannel = Region.hasColorChannel( curRenderModes ); final boolean hasColorTexture = Region.hasColorTexture( curRenderModes ) && null != colorTexSeq; @@ -189,7 +187,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion { final RenderState rs = renderer.getRenderState(); final boolean hasAABBoxClipping = null != rs.getClipBBox() && ( ( !isTwoPass && pass1 ) || ( isTwoPass && !pass1 ) ); - final boolean updateLocGlobal = renderer.useShaderProgram(gl, curRenderModes, pass1, pass2Quality, sampleCount, colorTexSeq); + final boolean updateLocGlobal = renderer.useShaderProgram(gl, curRenderModes, pass1, colorTexSeq); final ShaderProgram sp = renderer.getRenderState().getShaderProgram(); final boolean updateLocLocal; if( pass1 ) { @@ -243,7 +241,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion { private static final int border = 2; // surrounding border, i.e. width += 2*border, height +=2*border @Override - protected void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int curRenderModes, final int pass2Quality, final int[/*1*/] sampleCount) { + protected void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int curRenderModes) { if( 0 >= indicesBuffer.getElemCount() ) { if(DEBUG_INSTANCE) { System.err.printf("VBORegion2PMSAAES2.drawImpl: Empty%n"); @@ -259,8 +257,8 @@ public final class VBORegion2PMSAAES2 extends GLRegion { final RenderState rs = renderer.getRenderState(); final int vpWidth = renderer.getWidth(); final int vpHeight = renderer.getHeight(); - if(vpWidth <=0 || vpHeight <= 0 || sampleCount[0] < 0) { - useShaderProgram(gl, renderer, curRenderModes, true, pass2Quality, sampleCount[0]); + if(vpWidth <=0 || vpHeight <= 0 || rs.getSampleCount() < 0) { + useShaderProgram(gl, renderer, curRenderModes, true); renderRegion(gl, rs, curRenderModes); } else { if(0 > maxTexSize[0]) { @@ -314,7 +312,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion { winWidth, winHeight, targetWinWidth, targetWinHeight, diffWinWidth, diffWinHeight, ratioWinWidth, ratioWinHeight, targetFboWidth, targetFboHeight, - sampleCount[0]); + rs.getSampleCount()); } } if( 0 >= targetFboWidth || 0 >= targetFboHeight ) { @@ -328,7 +326,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion { System.err.printf("XXX.maxDelta: hasDelta %b: %d / %d, %.3f, %.3f%n", hasDelta, deltaFboWidth, deltaFboHeight, (float)deltaFboWidth/fboWidth, (float)deltaFboHeight/fboHeight); System.err.printf("XXX.Scale %d * [%f x %f]: %d x %d%n", - sampleCount[0], winWidth, winHeight, targetFboWidth, targetFboHeight); + rs.getSampleCount(), winWidth, winHeight, targetFboWidth, targetFboHeight); } if( hasDelta || fboDirty || isShapeDirty() || null == fbo ) { // FIXME: rescale @@ -348,24 +346,24 @@ public final class VBORegion2PMSAAES2 extends GLRegion { } gca_FboVerticesAttr.seal(true); matP.setToOrtho(minX, maxX, minY, maxY, -1, 1); - useShaderProgram(gl, renderer, curRenderModes, true, pass2Quality, sampleCount[0]); + useShaderProgram(gl, renderer, curRenderModes, true); renderRegion2FBO(gl, rs, curRenderModes, // (int)drawWinBox.getMinX(), (int)drawWinBox.getMinY(), targetFboWidth, targetFboHeight, 0, 0, targetFboWidth, targetFboHeight, - vpWidth, vpHeight, sampleCount); + vpWidth, vpHeight); } else if( isStateDirty() ) { - useShaderProgram(gl, renderer, curRenderModes, true, pass2Quality, sampleCount[0]); + useShaderProgram(gl, renderer, curRenderModes, true); renderRegion2FBO(gl, rs, curRenderModes, // (int)drawWinBox.getMinX(), (int)drawWinBox.getMinY(), targetFboWidth, targetFboHeight, 0, 0, targetFboWidth, targetFboHeight, - vpWidth, vpHeight, sampleCount); + vpWidth, vpHeight); } - useShaderProgram(gl, renderer, curRenderModes, false, pass2Quality, sampleCount[0]); - renderFBO(gl, rs, vpWidth, vpHeight, sampleCount[0]); + useShaderProgram(gl, renderer, curRenderModes, false); + renderFBO(gl, rs, vpWidth, vpHeight); } } - private void renderFBO(final GL2ES2 gl, final RenderState rs, final int width, final int height, final int sampleCount) { + private void renderFBO(final GL2ES2 gl, final RenderState rs, final int width, final int height) { gl.glViewport(0, 0, width, height); if( rs.isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED | RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) { @@ -410,12 +408,12 @@ public final class VBORegion2PMSAAES2 extends GLRegion { private void renderRegion2FBO(final GL2ES2 gl, final RenderState rs, final int curRenderModes, final int fboX, final int fboY, final int targetFboWidth, final int targetFboHeight, - final int vpWidth, final int vpHeight, final int[] sampleCount) { + final int vpWidth, final int vpHeight) { if( 0 >= targetFboWidth || 0 >= targetFboHeight ) { throw new IllegalArgumentException("targetFBOSize "+targetFboWidth+"x"+targetFboHeight+" must be greater than 0"); } final boolean blendingEnabled = rs.isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED); - final int targetFboSamples = sampleCount[0] > 1 ? sampleCount[0] : 0; + final int targetFboSamples = rs.getSampleCount() > 1 ? rs.getSampleCount() : 0; final boolean fboSampleTypeMatch; { final int oldSampleCount = null != fbo ? fbo.getNumSamples() : 0; @@ -430,7 +428,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion { fboHeight = targetFboHeight; fbo = new FBObject(); fbo.init(gl, targetFboWidth, targetFboHeight, targetFboSamples); - sampleCount[0] = Math.max(1, fbo.getNumSamples()); + rs.setSampleCount( Math.max(1, fbo.getNumSamples()) ); if( 0 == targetFboSamples ) { texA = fbo.attachTexture2D(gl, 0, true, GL.GL_LINEAR, GL.GL_LINEAR, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE); if( !blendingEnabled ) { @@ -460,7 +458,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion { } } else if( targetFboWidth != fboWidth || targetFboHeight != fboHeight || fbo.getNumSamples() != targetFboSamples ) { fbo.reset(gl, targetFboWidth, targetFboHeight, targetFboSamples); - sampleCount[0] = Math.max(1, fbo.getNumSamples()); + rs.setSampleCount( Math.max(1, fbo.getNumSamples()) ); if( DEBUG_FBO_1 ) { System.err.printf("XXX.resetFBO: %dx%d -> %dx%d%n%s%n", fboWidth, fboHeight, targetFboWidth, targetFboHeight, fbo ); } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java index 7c6ea9d3b..bf23f33e9 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java @@ -106,10 +106,8 @@ public final class VBORegion2PVBAAES2 extends GLRegion { * @param renderer * @param curRenderModes * @param pass1 - * @param pass2Quality - * @param sampleCount */ - public void useShaderProgram(final GL2ES2 gl, final RegionRenderer renderer, final int curRenderModes, final boolean pass1, final int pass2Quality, final int sampleCount) { + public void useShaderProgram(final GL2ES2 gl, final RegionRenderer renderer, final int curRenderModes, final boolean pass1) { final boolean isTwoPass = Region.isTwoPass( curRenderModes ); final boolean hasColorChannel = Region.hasColorChannel( curRenderModes ); final boolean hasColorTexture = Region.hasColorTexture( curRenderModes ) && null != colorTexSeq; @@ -117,7 +115,7 @@ public final class VBORegion2PVBAAES2 extends GLRegion { final RenderState rs = renderer.getRenderState(); final boolean hasAABBoxClipping = null != rs.getClipBBox() && ( ( !isTwoPass && pass1 ) || ( isTwoPass && !pass1 ) ); - final boolean updateLocGlobal = renderer.useShaderProgram(gl, curRenderModes, pass1, pass2Quality, sampleCount, colorTexSeq); + final boolean updateLocGlobal = renderer.useShaderProgram(gl, curRenderModes, pass1, colorTexSeq); final ShaderProgram sp = renderer.getRenderState().getShaderProgram(); final boolean updateLocLocal; if( pass1 ) { @@ -159,7 +157,7 @@ public final class VBORegion2PVBAAES2 extends GLRegion { } rsLocal.update(gl, rs, updateLocLocal, curRenderModes, true, false, true); rs.updateUniformDataLoc(gl, updateLocLocal, false /* updateData */, gcu_FboTexUnit, true); // FIXME always update if changing tex-unit - rs.updateUniformLoc(gl, updateLocLocal, gcu_FboTexSize, sampleCount > 1); // maybe optimized away for sampleCount <= 1 + rs.updateUniformLoc(gl, updateLocLocal, gcu_FboTexSize, rs.getSampleCount() > 1); // maybe optimized away for sampleCount <= 1 } if( hasAABBoxClipping && updateLocLocal ) { rs.updateUniformLoc(gl, true, gcu_ClipBBox, true); @@ -249,7 +247,7 @@ public final class VBORegion2PVBAAES2 extends GLRegion { private static final int border = 2; // surrounding border, i.e. width += 2*border, height +=2*border @Override - protected void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int curRenderModes, final int pass2Quality, final int[/*1*/] sampleCount) { + protected void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int curRenderModes) { if( 0 >= indicesBuffer.getElemCount() ) { if(DEBUG_INSTANCE) { System.err.printf("VBORegion2PVBAAES2.drawImpl: Empty%n"); @@ -265,8 +263,9 @@ public final class VBORegion2PVBAAES2 extends GLRegion { final RenderState rs = renderer.getRenderState(); final int vpWidth = renderer.getWidth(); final int vpHeight = renderer.getHeight(); - if(vpWidth <=0 || vpHeight <= 0 || sampleCount[0] < 0) { - useShaderProgram(gl, renderer, curRenderModes, true, pass2Quality, sampleCount[0]); + int pass2SampleCount = rs.getSampleCount(); + if(vpWidth <=0 || vpHeight <= 0 || pass2SampleCount < 0) { + useShaderProgram(gl, renderer, curRenderModes, true); renderRegion(gl, rs, curRenderModes); } else { if(0 > maxTexSize[0]) { @@ -303,16 +302,16 @@ public final class VBORegion2PVBAAES2 extends GLRegion { diffObjBorderWidth = border * ratioObjWinWidth; diffObjBorderHeight = border * ratioObjWinHeight; - targetFboWidth = (targetWinWidth+2*border)*sampleCount[0]; - targetFboHeight = (targetWinHeight+2*border)*sampleCount[0]; + targetFboWidth = (targetWinWidth+2*border)*pass2SampleCount; + targetFboHeight = (targetWinHeight+2*border)*pass2SampleCount; if( DEBUG_FBO_2 ) { final float ratioWinWidth, ratioWinHeight; ratioWinWidth = winWidth/targetWinWidth; ratioWinHeight = winHeight/targetWinHeight; final float renderFboWidth, renderFboHeight; - renderFboWidth = (winWidth+2*border)*sampleCount[0]; - renderFboHeight = (winHeight+2*border)*sampleCount[0]; + renderFboWidth = (winWidth+2*border)*pass2SampleCount; + renderFboHeight = (winHeight+2*border)*pass2SampleCount; final float ratioFboWidth, ratioFboHeight; ratioFboWidth = renderFboWidth/targetFboWidth; ratioFboHeight = renderFboHeight/targetFboHeight; @@ -330,7 +329,7 @@ public final class VBORegion2PVBAAES2 extends GLRegion { diffWinWidth, diffWinHeight, ratioWinWidth, ratioWinHeight, renderFboWidth, renderFboHeight, targetFboWidth, targetFboHeight, diffFboWidth, diffFboHeight, ratioFboWidth, ratioFboHeight, - sampleCount[0]); + pass2SampleCount); } } if( 0 >= targetFboWidth || 0 >= targetFboHeight ) { @@ -344,27 +343,28 @@ public final class VBORegion2PVBAAES2 extends GLRegion { System.err.printf("XXX.maxDelta: hasDelta %b: %d / %d, %.3f, %.3f%n", hasDelta, deltaFboWidth, deltaFboHeight, (float)deltaFboWidth/fboWidth, (float)deltaFboHeight/fboHeight); System.err.printf("XXX.Scale %d * [%f x %f]: %d x %d%n", - sampleCount[0], winWidth, winHeight, targetFboWidth, targetFboHeight); + pass2SampleCount, winWidth, winHeight, targetFboWidth, targetFboHeight); } if( hasDelta || fboDirty || isShapeDirty() || null == fbo ) { final int maxLength = Math.max(targetFboWidth, targetFboHeight); if( maxLength > maxTexSize[0] ) { if( targetFboWidth > targetFboHeight ) { - sampleCount[0] = (int)Math.floor(maxTexSize[0] / (winWidth+2*border)); + pass2SampleCount = (int)Math.floor(maxTexSize[0] / (winWidth+2*border)); } else { - sampleCount[0] = (int)Math.floor(maxTexSize[0] / (winHeight+2*border)); + pass2SampleCount = (int)Math.floor(maxTexSize[0] / (winHeight+2*border)); } + rs.setSampleCount(pass2SampleCount); final float renderFboWidth, renderFboHeight; - renderFboWidth = (winWidth+2*border)*sampleCount[0]; - renderFboHeight = (winHeight+2*border)*sampleCount[0]; + renderFboWidth = (winWidth+2*border)*pass2SampleCount; + renderFboHeight = (winHeight+2*border)*pass2SampleCount; targetFboWidth = (int)Math.ceil(renderFboWidth); targetFboHeight = (int)Math.ceil(renderFboHeight); if( DEBUG_FBO_1 ) { System.err.printf("XXX.Rescale (MAX): win[%.3f, %.3f]: FBO f[%.3f, %.3f], i[%d x %d], msaa %d%n", winWidth, winHeight, - renderFboWidth, renderFboHeight, targetFboWidth, targetFboHeight, sampleCount[0]); + renderFboWidth, renderFboHeight, targetFboWidth, targetFboHeight, pass2SampleCount); } - if( sampleCount[0] <= 0 ) { + if( pass2SampleCount <= 0 ) { // Last way out! renderRegion(gl, rs, curRenderModes); return; @@ -387,20 +387,20 @@ public final class VBORegion2PVBAAES2 extends GLRegion { } gca_FboVerticesAttr.seal(true); matP.setToOrtho(minX, maxX, minY, maxY, -1, 1); - useShaderProgram(gl, renderer, curRenderModes, true, pass2Quality, sampleCount[0]); + useShaderProgram(gl, renderer, curRenderModes, true); renderRegion2FBO(gl, rs, curRenderModes, // (int)drawWinBox.getMinX(), (int)drawWinBox.getMinY(), targetFboWidth, targetFboHeight, 0, 0, targetFboWidth, targetFboHeight, - vpWidth, vpHeight, sampleCount[0]); + vpWidth, vpHeight, pass2SampleCount); } else if( isStateDirty() ) { - useShaderProgram(gl, renderer, curRenderModes, true, pass2Quality, sampleCount[0]); + useShaderProgram(gl, renderer, curRenderModes, true); renderRegion2FBO(gl, rs, curRenderModes, // (int)drawWinBox.getMinX(), (int)drawWinBox.getMinY(), targetFboWidth, targetFboHeight, 0, 0, targetFboWidth, targetFboHeight, - vpWidth, vpHeight, sampleCount[0]); + vpWidth, vpHeight, pass2SampleCount); } - useShaderProgram(gl, renderer, curRenderModes, false, pass2Quality, sampleCount[0]); - renderFBO(gl, rs, targetFboWidth, targetFboHeight, vpWidth, vpHeight, sampleCount[0]); + useShaderProgram(gl, renderer, curRenderModes, false); + renderFBO(gl, rs, targetFboWidth, targetFboHeight, vpWidth, vpHeight, pass2SampleCount); } } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java index 80795e8f1..3a568758c 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -124,7 +124,7 @@ public final class VBORegionSPES2 extends GLRegion { final RenderState rs = renderer.getRenderState(); final boolean hasAABBoxClipping = null != rs.getClipBBox(); - final boolean updateLocGlobal = renderer.useShaderProgram(gl, curRenderModes, true, 0 /* pass2Quality */, 0 /* sampleCount */, colorTexSeq); + final boolean updateLocGlobal = renderer.useShaderProgram(gl, curRenderModes, true, colorTexSeq); final ShaderProgram sp = renderer.getRenderState().getShaderProgram(); final boolean updateLocLocal = !sp.equals(spPass1); spPass1 = sp; @@ -152,7 +152,7 @@ public final class VBORegionSPES2 extends GLRegion { @Override - protected void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int curRenderModes, final int pass2Quality, final int[/*1*/] sampleCount) { + protected void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int curRenderModes) { // final boolean hasColorChannel = Region.hasColorChannel( curRenderModes ); final boolean hasColorTexture = Region.hasColorTexture( curRenderModes ); |