From 7b1a0c17fe5471557ab5e0db0334bed34edb553a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 2 Mar 2014 00:19:35 +0100 Subject: Bug 801: Add MSAA_RENDERING_BIT ; VBAA: Uses GL_NEAREST (good result) ; Demos: Use local GLRegion for uncached text (perf.) .. --- .../classes/com/jogamp/graph/curve/Region.java | 44 ++++++++++++++++++---- .../jogamp/graph/curve/opengl/RegionRenderer.java | 9 ++++- src/jogl/classes/com/jogamp/opengl/FBObject.java | 4 +- 3 files changed, 46 insertions(+), 11 deletions(-) (limited to 'src/jogl/classes/com') diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java index 9d6e339f2..8e68b7913 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/Region.java +++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java @@ -30,7 +30,8 @@ package com.jogamp.graph.curve; import java.util.ArrayList; import java.util.List; -import jogamp.graph.curve.opengl.VBORegion2PES2; +import jogamp.graph.curve.opengl.VBORegion2PVBAAES2; +import jogamp.graph.curve.opengl.VBORegion2PMSAAES2; import jogamp.graph.curve.opengl.VBORegionSPES2; import jogamp.graph.geom.plane.AffineTransform; import jogamp.opengl.Debug; @@ -52,18 +53,25 @@ public abstract class Region { public static final boolean DEBUG_INSTANCE = Debug.debug("graph.curve.instance"); /** - * View based Anti-Aliasing, A Two pass region rendering, slower and more + * MSAA based Anti-Aliasing, a two pass region rendering, slower and more + * resource hungry (FBO), but providing fast MSAA in case + * the whole scene is not rendered with MSAA. + */ + public static final int MSAA_RENDERING_BIT = 1 << 0; + + /** + * View based Anti-Aliasing, a two pass region rendering, slower and more * resource hungry (FBO), but AA is perfect. Otherwise the default fast one * pass MSAA region rendering is being used. */ - public static final int VBAA_RENDERING_BIT = 1 << 0; + public static final int VBAA_RENDERING_BIT = 1 << 1; /** * Use non uniform weights [0.0 .. 1.9] for curve region rendering. * Otherwise the default weight 1.0 for uniform curve region rendering is * being applied. */ - public static final int VARIABLE_CURVE_WEIGHT_BIT = 1 << 1; + public static final int VARIABLE_CURVE_WEIGHT_BIT = 1 << 8; public static final int TWO_PASS_DEFAULT_TEXTURE_UNIT = 0; @@ -75,6 +83,18 @@ public abstract class Region { public static boolean isVBAA(int renderModes) { return 0 != (renderModes & Region.VBAA_RENDERING_BIT); } + public static boolean isMSAA(int renderModes) { + return 0 != (renderModes & Region.MSAA_RENDERING_BIT); + } + public static String getRenderModeString(int renderModes) { + if( Region.isVBAA(renderModes) ) { + return "vbaa"; + } else if( Region.isMSAA(renderModes) ) { + return "msaa"; + } else { + return "norm" ; + } + } /** * Check if render mode capable of non uniform weights @@ -98,10 +118,11 @@ public abstract class Region { * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT} */ public static GLRegion create(int renderModes) { - if( 0 != ( Region.VBAA_RENDERING_BIT & renderModes ) ){ - return new VBORegion2PES2(renderModes, Region.TWO_PASS_DEFAULT_TEXTURE_UNIT); - } - else{ + if( isVBAA(renderModes) ) { + return new VBORegion2PVBAAES2(renderModes, Region.TWO_PASS_DEFAULT_TEXTURE_UNIT); + } else if( isMSAA(renderModes) ) { + return new VBORegion2PMSAAES2(renderModes, Region.TWO_PASS_DEFAULT_TEXTURE_UNIT); + } else { return new VBORegionSPES2(renderModes); } } @@ -135,6 +156,13 @@ public abstract class Region { return isVBAA(renderModes); } + /** + * Return true if capable of two pass rendering - MSAA, otherwise false. + */ + public final boolean isMSAA() { + return isMSAA(renderModes); + } + /** * Return true if capable of nonuniform weights, otherwise 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 92fa084cd..7e0c17eb9 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -294,7 +294,14 @@ public abstract class RegionRenderer { protected String getFragmentShaderName() { final String version = getImplVersion(); - final String pass = Region.isVBAA(renderModes) ? "-2pass" : "-1pass" ; + final String pass; + if( Region.isVBAA(renderModes) ) { + pass = "-2pass_vbaa"; + } else if( Region.isMSAA(renderModes) ) { + pass = "-2pass_msaa"; + } else { + pass = "-1pass_norm" ; + } final String weight = Region.isNonUniformWeight(renderModes) ? "-weight" : "" ; return "curverenderer" + version + pass + weight; } diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java index 90a8dc073..33751eab9 100644 --- a/src/jogl/classes/com/jogamp/opengl/FBObject.java +++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java @@ -2316,8 +2316,8 @@ public class FBObject { return "FBO[name r/w "+fbName+"/"+getReadFramebuffer()+", init "+initialized+", bound "+bound+", size "+width+"x"+height+ ", samples "+samples+"/"+maxSamples+", depth "+depth+", stencil "+stencil+ ", color attachments: "+colorAttachmentCount+"/"+maxColorAttachments+ - ": "+caps+", msaa-sink "+samplingSinkTexture+", hasSamplesSink "+(null != samplingSink)+ - ", state "+getStatusString()+", obj "+toHexString(objectHashCode())+"]"; + ": "+caps+", msaa["+samplingSinkTexture+", hasSink "+(null != samplingSink)+ + ", dirty "+samplingSinkDirty+"], state "+getStatusString()+", obj "+toHexString(objectHashCode())+"]"; } private final void updateStatus(GL gl) { -- cgit v1.2.3