<?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>1228</bug_id>
          
          <creation_ts>2015-09-23 13:30:01 +0200</creation_ts>
          <short_desc>Allow setting other glBlendFunc in GLRegion renderer</short_desc>
          <delta_ts>2024-02-14 00:50:09 +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>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>enhancement</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>kdropucic</cc>
    
    <cc>rami.santina</cc>
    
    <cc>sgothel</cc>
          
          <cf_type>FEATURE</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>5204</commentid>
    <comment_count>0</comment_count>
    <who name="Alan Sambol">alan.zgb</who>
    <bug_when>2015-09-23 13:30:01 +0200</bug_when>
    <thetext>For RegionRenderer, blending can currently be set by renderState.setHintMask(RenderState.BITHINT_BLENDING_ENABLED). This always uses gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA) under the hood (hardcoded).

It would be nice to allow setting other blending functions for RenderState / TextRendererUtil, as we use different blending function in our framework - gl.glBlendFunc(GL.ONE, GL.GL_ONE_MINUS_SRC_ALPHA), for premultiplied alpha, which is de facto standard: http://blogs.msdn.com/b/shawnhar/archive/2009/11/06/premultiplied-alpha.aspx

Currently, I found it hardcoded in the following classes (it even mentions possibility of other functions in comments):

VBORegionSPES2, line 234:
        if( renderer.getRenderState().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED) ) {
            gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
        }

VBORegion2PVBAAES2, line 607:
VBORegion2PMSAAES2, line 493:

        if( blendingEnabled ) {
            gl.glClearColor(0f, 0f, 0f, 0.0f);
            gl.glClear(GL.GL_COLOR_BUFFER_BIT); // no depth-buffer w/ blending
            // For already pre-multiplied alpha values, use:
            // gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA);

            // Multiply RGB w/ Alpha, preserve alpha for renderFBO(..)
            gl.glBlendFuncSeparate(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA, GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA);
        } else {
            gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
        }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>7140</commentid>
    <comment_count>1</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2024-02-14 00:50:09 +0100</bug_when>
    <thetext>Not for now, perhaps on commission / contract</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>