<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>1272</bug_id>
          
          <creation_ts>2015-12-02 17:29:39 +0100</creation_ts>
          <short_desc>Two-pass TextRenderer color changing during runtime doesn&apos;t work if glyph caching is enabled</short_desc>
          <delta_ts>2024-02-14 00:53:17 +0100</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Jogl</product>
          <component>graph</component>
          <version>tbd</version>
          <rep_platform>All</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P4</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>1064</blocked>
          <everconfirmed>0</everconfirmed>
          <reporter name="Alan Sambol">alan.zgb</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          <cc>alan.zgb</cc>
    
    <cc>rami.santina</cc>
    
    <cc>sgothel</cc>
          
          <cf_type>DEFECT</cf_type>
          <cf_scm_refs></cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>5493</commentid>
    <comment_count>0</comment_count>
    <who name="Alan Sambol">alan.zgb</who>
    <bug_when>2015-12-02 17:29:39 +0100</bug_when>
    <thetext>I am using the following text rendering setup:

Initialisation:
	public void init(GL2ES2 gl) {		
		renderer = RegionRenderer.create(renderState, null, null);
		if (blending &amp;&amp; renderModes &gt; 0) {
renderState.setHintMask(RenderState.BITHINT_BLENDING_ENABLED);
		}
		// uses gl.glBlendFuncSeparate(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA, GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA)
		textRenderUtil = new TextRegionUtil(renderModes);
		renderer.init(gl, renderModes);
		renderer.enable(gl, false);
		textRenderUtil.setCacheLimit(2048);
	}

Rendering:
	public void renderString(GL2ES2 gl, String text, String font, float pixelSize, float color[], int sampleCount) {
		if (renderModes != 0 &amp;&amp; cullFace) {
			gl.glDisable(GL.GL_CULL_FACE);
		}
		this.sampleCount[0] = sampleCount;
		renderer.enable(gl, true);
		// Doesn&apos;t work if color changes during runtime with 2-pass rendering (VBAA/MSAA) with glyph caching enabled
		renderState.setColorStatic(color[0], color[1], color[2], color[3]);
		textRenderUtil.drawString3D(gl, renderer, fonts.get(font), pixelSize, text, null, this.sampleCount);
		renderer.enable(gl, false);
		if (renderModes != 0 &amp;&amp; cullFace) {
			gl.glEnable(GL.GL_CULL_FACE);
		}
	}

If I use random colorStatic per each frame with renderModes = 0, the color changes as expected with good FPS. If I use renderModes = Region.VBAA_RENDERING_BIT or renderModes = Region.MSAA_RENDERING_BIT the color never changes and always uses the first assigned value.

When textRenderUtil.setCacheLimit(1) is performed the color changes as expected again, but performance is terribly slow (5x less FPS than with cache).

Same happens textRenderUtil.clear() is performed before each render.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>7143</commentid>
    <comment_count>1</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2024-02-14 00:53:17 +0100</bug_when>
    <thetext>Should work now</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>