diff options
author | Kenneth Russel <[email protected]> | 2007-10-09 05:04:40 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2007-10-09 05:04:40 +0000 |
commit | a90cdf51f1a7cb6bf01046e90ad9fc88d906d980 (patch) | |
tree | 24f5a6629139ef7cda8445fd33ef2fdac8bd0aa8 /src | |
parent | 487efe1bea563865643c20206be7fc78854b8139 (diff) |
Integrated John Burkey's new TextRenderer implementation using
glyph-by-glyph caching for most cases, with fallbacks to
String-by-String caching for complete Unicode correctness. New
implementation yields drastic performance improvements for
applications displaying large amounts of dynamic text. Upgraded JOGL
demos to work with new TextRenderer.
This checkin fixes at least the following issues:
Issue 261: Throttle shrinking of backing store texture for TextRenderer
Issue 293: TextRenderer: width of strings with spaces not correct in RC4
Issue 294: TextRenderer: rendering stops when a string is wider than the maximum texture size
Issue 304: TextRenderer rendering artifacts in 3D mode
as well as outstanding performance issues with the current
TextRenderer reported on the JOGL forum.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/trunk@221 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src')
-rwxr-xr-x | src/demos/j2d/CustomText.java | 15 | ||||
-rwxr-xr-x | src/demos/j2d/FlyingText.java | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/demos/j2d/CustomText.java b/src/demos/j2d/CustomText.java index 6032d23..05c0048 100755 --- a/src/demos/j2d/CustomText.java +++ b/src/demos/j2d/CustomText.java @@ -384,6 +384,12 @@ public class CustomText extends Demo { return false; } + public Rectangle2D getBounds(CharSequence str, + Font font, + FontRenderContext frc) { + return getBounds(str.toString(), font, frc); + } + public Rectangle2D getBounds(String str, Font font, FontRenderContext frc) { @@ -395,6 +401,15 @@ public class CustomText extends Demo { stringBounds.getHeight() + dropShadowDepth); } + public void drawGlyphVector(Graphics2D graphics, GlyphVector str, int x, int y) { + graphics.setColor(DROP_SHADOW_COLOR); + graphics.drawGlyphVector(str, x + dropShadowDepth, y + dropShadowDepth); + graphics.setColor(Color.WHITE); + graphics.setPaint(new GradientPaint(x, y, color1, + x, y + gradientSize / 2, color2, + true)); + graphics.drawGlyphVector(str, x, y); + } public void draw(Graphics2D graphics, String str, int x, int y) { graphics.setColor(DROP_SHADOW_COLOR); diff --git a/src/demos/j2d/FlyingText.java b/src/demos/j2d/FlyingText.java index 205263e..81deeec 100755 --- a/src/demos/j2d/FlyingText.java +++ b/src/demos/j2d/FlyingText.java @@ -359,6 +359,8 @@ public class FlyingText extends Demo { 0); gl.glRotatef(info.angle, 0, 0, 1); renderer.draw(info.text, 0, 0); + // We need to call flush() only because we're modifying the modelview matrix + renderer.flush(); } // Now render the actual text @@ -371,6 +373,8 @@ public class FlyingText extends Demo { gl.glRotatef(info.angle, 0, 0, 1); renderer.setColor(info.r, info.g, info.b, 1); renderer.draw(info.text, 0, 0); + // We need to call flush() only because we're modifying the modelview matrix + renderer.flush(); } renderer.endRendering(); |