diff options
author | Sven Gothel <[email protected]> | 2014-03-02 00:19:35 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-03-02 00:19:35 +0100 |
commit | 7b1a0c17fe5471557ab5e0db0334bed34edb553a (patch) | |
tree | c6242b548f4f9cbe2411c8cb4bc6dd6924437e8b /src/jogl/classes/com/jogamp/graph/curve | |
parent | c1218a7bcf42ae64b41e3d30bb1ee39c44b20a9f (diff) |
Bug 801: Add MSAA_RENDERING_BIT ; VBAA: Uses GL_NEAREST (good result) ; Demos: Use local GLRegion for uncached text (perf.) ..
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/curve')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/Region.java | 44 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java | 9 |
2 files changed, 44 insertions, 9 deletions
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); } } @@ -136,6 +157,13 @@ public abstract class Region { } /** + * 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. */ public final boolean isNonUniformWeight() { 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; } |