From 5a88315a74d09ff169af66e407f47a3472e747b7 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sat, 16 Feb 2008 07:57:45 +0000 Subject: Fixed Issue 342: demos/j2d/TextFlow (TextRenderer) demo gives fuzzy text Added setSmoothing / getSmoothing to TextRenderer API to offer control over filtering mode of the TextureRenderer backing store. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1528 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../com/sun/opengl/util/j2d/TextRenderer.java | 39 ++++++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'src/classes/com/sun') diff --git a/src/classes/com/sun/opengl/util/j2d/TextRenderer.java b/src/classes/com/sun/opengl/util/j2d/TextRenderer.java index 5ac297812..edc3475b0 100755 --- a/src/classes/com/sun/opengl/util/j2d/TextRenderer.java +++ b/src/classes/com/sun/opengl/util/j2d/TextRenderer.java @@ -201,6 +201,9 @@ public class TextRenderer { private boolean isExtensionAvailable_GL_VERSION_1_5; private boolean checkFor_isExtensionAvailable_GL_VERSION_1_5; + // Whether GL_LINEAR filtering is enabled for the backing store + private boolean smoothing = true; + /** Creates a new TextRenderer with the given font, using no antialiasing or fractional metrics, and the default RenderDelegate. Equivalent to TextRenderer(font, false, @@ -1241,6 +1244,7 @@ public class TextRenderer { } else { renderer = new TextureRenderer(w, h, true, mipmap); } + renderer.setSmoothing(smoothing); if (DEBUG) { System.err.println(" TextRenderer allocating backing store " + @@ -1890,6 +1894,17 @@ public class TextRenderer { } } + /** + * Sets whether vertex arrays are being used internally for + * rendering, or whether text is rendered using the OpenGL + * immediate mode commands. This is provided as a concession for + * certain graphics cards which have poor vertex array + * performance. Defaults to true. + */ + public void setUseVertexArrays(boolean useVertexArrays) { + this.useVertexArrays = useVertexArrays; + } + /** * Indicates whether vertex arrays are being used internally for * rendering, or whether text is rendered using the OpenGL @@ -1900,14 +1915,24 @@ public class TextRenderer { } /** - * Sets whether vertex arrays are being used internally for - * rendering, or whether text is rendered using the OpenGL - * immediate mode commands. This is provided as a concession for - * certain graphics cards which have poor vertex array - * performance. Defaults to true. + * Sets whether smoothing (i.e., GL_LINEAR filtering) is enabled + * in the backing TextureRenderer of this TextRenderer. A few + * graphics cards do not behave well when this is enabled, + * resulting in fuzzy text. Defaults to true. */ - public void setUseVertexArrays(boolean useVertexArrays) { - this.useVertexArrays = useVertexArrays; + public void setSmoothing(boolean smoothing) { + this.smoothing = smoothing; + getBackingStore().setSmoothing(smoothing); + } + + /** + * Indicates whether smoothing is enabled in the backing + * TextureRenderer of this TextRenderer. A few graphics cards do + * not behave well when this is enabled, resulting in fuzzy text. + * Defaults to true. + */ + public boolean getSmoothing() { + return smoothing; } private boolean is15Available(GL gl) { -- cgit v1.2.3