diff options
author | Sven Gothel <[email protected]> | 2014-04-02 04:41:48 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-04-02 04:41:48 +0200 |
commit | e8a5a1cbb988670ca206ab1ac633e19a91bfa478 (patch) | |
tree | 5b9f17a06ad350150375a2a0e38daa3d6dd11251 /src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java | |
parent | 6f5686696b1e9085a759774056c7be9887a9e34f (diff) |
Bug 801: WIP 2/2 - Add color attribute; Switch Shader instead of branching in shader; Update attributes and uniforms manually, drop ShaderState;
- Due to shader-switching,
'renderModes' are now local to Region, e.g. UIShape etc
- Remove RegionRenderer.renderModes
- VBORegion2P*:
- Use simple 2x float matrix for orthogonal P+Mv
- Cleanup shader
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java index 6d9fdab0b..16b1224bd 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java @@ -48,10 +48,10 @@ import com.jogamp.graph.geom.Vertex.Factory; */ public class TextRegionUtil { - public final RegionRenderer renderer; + public final int renderModes; - public TextRegionUtil(final RegionRenderer renderer) { - this.renderer = renderer; + public TextRegionUtil(final int renderModes) { + this.renderModes = renderModes; } public static interface ShapeVisitor { @@ -144,6 +144,7 @@ public class TextRegionUtil { * Cached {@link GLRegion}s will be destroyed w/ {@link #clear(GL2ES2)} or to free memory. * </p> * @param gl the current GL state + * @param renderer TODO * @param font {@link Font} to be used * @param pixelSize Use {@link Font#getPixelSize(float, float)} for resolution correct pixel-size. * @param str text to be rendered @@ -153,15 +154,15 @@ public class TextRegionUtil { * @throws Exception if TextRenderer not initialized */ public void drawString3D(final GL2ES2 gl, - final Font font, final float pixelSize, final CharSequence str, - final float[] rgbaColor, final int[/*1*/] sampleCount) { + final RegionRenderer renderer, final Font font, final float pixelSize, + final CharSequence str, final float[] rgbaColor, final int[/*1*/] sampleCount) { if( !renderer.isInitialized() ) { throw new GLException("TextRendererImpl01: not initialized!"); } final int special = 0; GLRegion region = getCachedRegion(font, str, pixelSize, special); if(null == region) { - region = GLRegion.create(renderer.getRenderModes()); + region = GLRegion.create(renderModes); addStringToRegion(region, renderer.getRenderState().getVertexFactory(), font, pixelSize, str, rgbaColor); addCachedRegion(gl, font, str, pixelSize, special, region); } @@ -174,10 +175,11 @@ public class TextRegionUtil { * <p> * In case of a multisampling region renderer, i.e. {@link Region#VBAA_RENDERING_BIT}, recreating the {@link GLRegion} * is a huge performance impact. - * In such case better use {@link #drawString3D(GLRegion, RegionRenderer, GL2ES2, Font, float, CharSequence, float[], int[])} + * In such case better use {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, float, CharSequence, float[], int[])} * instead. * </p> * @param gl the current GL state + * @param renderModes TODO * @param font {@link Font} to be used * @param pixelSize Use {@link Font#getPixelSize(float, float)} for resolution correct pixel-size. * @param str text to be rendered @@ -186,21 +188,21 @@ public class TextRegionUtil { * The actual used scample-count is written back when msaa-rendering is enabled, otherwise the store is untouched. * @throws Exception if TextRenderer not initialized */ - public static void drawString3D(final RegionRenderer renderer, final GL2ES2 gl, - final Font font, final float pixelSize, final CharSequence str, - final float[] rgbaColor, final int[/*1*/] sampleCount) { + public static void drawString3D(final GL2ES2 gl, final int renderModes, + final RegionRenderer renderer, final Font font, final float pixelSize, + final CharSequence str, final float[] rgbaColor, final int[/*1*/] sampleCount) { if(!renderer.isInitialized()){ throw new GLException("TextRendererImpl01: not initialized!"); } - final GLRegion region = GLRegion.create(renderer.getRenderModes()); + final GLRegion region = GLRegion.create(renderModes); addStringToRegion(region, renderer.getRenderState().getVertexFactory(), font, pixelSize, str, rgbaColor); region.draw(gl, renderer, sampleCount); - region.destroy(gl, renderer); + region.destroy(gl); } /** * Render the string in 3D space w.r.t. the font and pixelSize - * using the given {@link GLRegion}, which will {@link GLRegion#clear(GL2ES2, RegionRenderer) cleared} beforehand. + * using the given {@link GLRegion}, which will {@link GLRegion#clear(GL2ES2) cleared} beforehand. * @param gl the current GL state * @param font {@link Font} to be used * @param pixelSize Use {@link Font#getPixelSize(float, float)} for resolution correct pixel-size. @@ -210,13 +212,13 @@ public class TextRegionUtil { * The actual used scample-count is written back when msaa-rendering is enabled, otherwise the store is untouched. * @throws Exception if TextRenderer not initialized */ - public static void drawString3D(final GLRegion region, final RegionRenderer renderer, final GL2ES2 gl, + public static void drawString3D(final GL2ES2 gl, final GLRegion region, final RegionRenderer renderer, final Font font, final float pixelSize, final CharSequence str, final float[] rgbaColor, final int[/*1*/] sampleCount) { if(!renderer.isInitialized()){ throw new GLException("TextRendererImpl01: not initialized!"); } - region.clear(gl, renderer); + region.clear(gl); addStringToRegion(region, renderer.getRenderState().getVertexFactory(), font, pixelSize, str, rgbaColor); region.draw(gl, renderer, sampleCount); } @@ -229,7 +231,7 @@ public class TextRegionUtil { final Iterator<GLRegion> iterator = stringCacheMap.values().iterator(); while(iterator.hasNext()){ final GLRegion region = iterator.next(); - region.destroy(gl, renderer); + region.destroy(gl); } stringCacheMap.clear(); stringCacheArray.clear(); @@ -295,7 +297,7 @@ public class TextRegionUtil { final String key = getKey(font, str, pixelSize, special); final GLRegion region = stringCacheMap.remove(key); if(null != region) { - region.destroy(gl, renderer); + region.destroy(gl); } stringCacheArray.remove(key); } @@ -305,7 +307,7 @@ public class TextRegionUtil { if( null != key ) { final GLRegion region = stringCacheMap.remove(key); if(null != region) { - region.destroy(gl, renderer); + region.destroy(gl); } } } |