diff options
author | Kenneth Russel <[email protected]> | 2008-02-16 07:57:45 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2008-02-16 07:57:45 +0000 |
commit | 5a88315a74d09ff169af66e407f47a3472e747b7 (patch) | |
tree | 1409c37d22e601f9d3172929a6e433f724148734 /src/classes | |
parent | c52763f9ba6240fad8e53647bf7bfe927561ee93 (diff) |
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
Diffstat (limited to 'src/classes')
-rwxr-xr-x | src/classes/com/sun/opengl/util/j2d/TextRenderer.java | 39 |
1 files changed, 32 insertions, 7 deletions
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 <code>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 " + @@ -1891,6 +1895,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 * immediate mode commands. Defaults to true. @@ -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) { |