/** Changes the current color of this TextureRenderer to the supplied one. The default color is opaque white. See {@link #setColor(float,float,float,float) setColor} for more details. @param color the new color to use for rendering @throws GLException If an OpenGL context is not current when this method is called */ public void setColor(final Color color) throws GLException { // Get color's RGBA components as floats in the range [0,1]. if (compArray == null) { compArray = new float[4]; } color.getRGBComponents(compArray); setColor(compArray[0], compArray[1], compArray[2], compArray[3]); }
/** 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; }