/** * 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 setSmoothing(final boolean smoothing) { this.smoothing = smoothing; getBackingStore().setSmoothing(smoothing); }
private Graphics2D getGraphics2D() { final TextureRenderer renderer = getBackingStore(); if (cachedGraphics == null) { cachedGraphics = renderer.createGraphics(); // Set up composite, font and rendering hints cachedGraphics.setComposite(AlphaComposite.Src); cachedGraphics.setColor(Color.WHITE); cachedGraphics.setFont(font); cachedGraphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, (antialiased ? RenderingHints.VALUE_TEXT_ANTIALIAS_ON : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF)); cachedGraphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, (useFractionalMetrics ? RenderingHints.VALUE_FRACTIONALMETRICS_ON : RenderingHints.VALUE_FRACTIONALMETRICS_OFF)); } return cachedGraphics; }
/** Changes the current color of this TextRenderer to the supplied one. The default color is opaque white. @param color the new color to use for rendering text @throws GLException If an OpenGL context is not current when this method is called */ public void setColor(final Color color) throws GLException { final boolean noNeedForFlush = (haveCachedColor && (cachedColor != null) && color.equals(cachedColor)); if (!noNeedForFlush) { flushGlyphPipeline(); } getBackingStore().setColor(color); haveCachedColor = true; cachedColor = color; }
/** Changes the current color of this TextRenderer to the supplied one, where each component ranges from 0.0f - 1.0f. The alpha component, if used, does not need to be premultiplied into the color channels as described in the documentation for {@link com.jogamp.opengl.util.texture.Texture Texture}, although premultiplied colors are used internally. The default color is opaque white. @param r the red component of the new color @param g the green component of the new color @param b the blue component of the new color @param a the alpha component of the new color, 0.0f = completely transparent, 1.0f = completely opaque @throws GLException If an OpenGL context is not current when this method is called */ public void setColor(final float r, final float g, final float b, final float a) throws GLException { final boolean noNeedForFlush = (haveCachedColor && (cachedColor == null) && (r == cachedR) && (g == cachedG) && (b == cachedB) && (a == cachedA)); if (!noNeedForFlush) { flushGlyphPipeline(); } getBackingStore().setColor(r, g, b, a); haveCachedColor = true; cachedR = r; cachedG = g; cachedB = b; cachedA = a; cachedColor = null; }
getBackingStore().beginOrthoRendering(width, height, disableDepthTestForOrtho); } else { getBackingStore().begin3DRendering(); getBackingStore().setColor(cachedR, cachedG, cachedB, cachedA); } else { getBackingStore().setColor(cachedColor); if (mipmap && !getBackingStore().isUsingAutoMipmapGeneration()) { if (DEBUG) { System.err.println("Disabled mipmapping in TextRenderer");
getBackingStore().markDirty(0, 0, getBackingStore().getWidth(), getBackingStore().getHeight());
getBackingStore().endOrthoRendering(); } else { getBackingStore().end3DRendering();
getBackingStore().markDirty(rect.x(), rect.y(), rect.w(), rect.h()); final TextureRenderer renderer = getBackingStore();