<?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>842</bug_id>
          
          <creation_ts>2013-09-25 00:53:09 +0200</creation_ts>
          <short_desc>GLJPanel&apos;s GLSL Image flip method requires glFrontFace to be GL_CCW</short_desc>
          <delta_ts>2014-01-25 00:39:07 +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>awt</component>
          <version>2</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>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Bill Kuker">bkuker</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          <cc>cmbruns</cc>
    
    <cc>gouessej</cc>
          
          <cf_type>---</cf_type>
          <cf_scm_refs>ab860381009c0716a99d33f0ce99f44617edf9ce</cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2989</commentid>
    <comment_count>0</comment_count>
    <who name="Bill Kuker">bkuker</who>
    <bug_when>2013-09-25 00:53:09 +0200</bug_when>
    <thetext>If you leave the front-face winding Clockwise (GL_CW) the glsl method to flip the image before reading it into the image raster fails to work.

The screen is left full of garbage, or black depending the system.

I assume the geometry that it draws the flipped image to ends up culled and nothing is drawn.

I&apos;d consider this minor because it is easy to work around, call gl.glFrontFace(GL.GL_CCW) at the end of display() and who changes the winding rule anyway!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2992</commentid>
    <comment_count>1</comment_count>
      <attachid>506</attachid>
    <who name="Mike Zimmerman">afterglow79</who>
    <bug_when>2013-09-26 21:31:58 +0200</bug_when>
    <thetext>Created attachment 506
Test case demonstrating this bug.

GL_CW should be usable as is - without extra (undocumented) commands.  This functionality is central to the application I am currently working on which renders semi-transparent objects, front and back.  The solution of resetting glFrontFace to GL_CCW did work for me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2999</commentid>
    <comment_count>2</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-09-29 21:15:27 +0200</bug_when>
    <thetext>(In reply to comment #1)
&gt; Created attachment 506 [details]
&gt; Test case demonstrating this bug.
&gt; 
&gt; GL_CW should be usable as is - without extra (undocumented) commands.  This
&gt; functionality is central to the application I am currently working on which
&gt; renders semi-transparent objects, front and back.  The solution of resetting
&gt; glFrontFace to GL_CCW did work for me.

For Bug 826, we started to preserve some states (viewport and texture)
while utilizing the GLContext for an GLSL based vertical flip.

The problem w/ the fixed function pipeline (ffp) is that there might be many states
involved influencing the flipping.

We could either disable it for ffp usage, or let it up to the user
to take care of it, as Bill mentioned.

I would vote for the latter and leave it as-is. But this is surely a matter of taste
and if leaving as-is, we might add some special API doc warning the user upfront.

Shall we discuss this issue with a broader audience ?

Sure .. if somebody is willing to analyze the ffp states and is able to
create such a helper class to preserve those states .. you are welcome.

Until then .. I am undecided.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3004</commentid>
    <comment_count>3</comment_count>
    <who name="Bill Kuker">bkuker</who>
    <bug_when>2013-09-29 22:06:44 +0200</bug_when>
    <thetext>I think the main trouble is surprise:

In my case my program was totally failing when I switched from GLCanvas to GLJPanel and I ended up writing a test program from scratch to convince myself that GLJPanel actually worked at all, and then started commenting out half of my code in display() at a time until I narrowed it down to the right thing.

This bug is very easy to work around once you know what you need to do, but it is very hard to know what you need to do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3011</commentid>
    <comment_count>4</comment_count>
    <who name="Julien Gouesse">gouessej</who>
    <bug_when>2013-10-01 10:33:55 +0200</bug_when>
    <thetext>I agree with Mike. In the worst case, it should be documented. I would prefer all states to be preserved in the fixed function pipeline and we could refine this mechanism later if it is too slow. A developer switching from GLCanvas to GLJPanel should not waste tons of time in working around undocumented state changes even though JOGL is open source. The test case mentioned by Mike is quite typical in scientific visualization, I had to do something similar when displaying some geological layers. The current situation is not satisfying. Please Sven, drive those limitations transparent for the developers or document them. Of course I prefer the former solution.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3027</commentid>
    <comment_count>5</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-10-02 16:37:08 +0200</bug_when>
    <thetext>Added &apos;Warning&apos; regarding GLSL vertical flipping - also added notice about 
how we preserve texture-unit states and the viewport.

I am aware that probably nobody will read those details, 
but at least it is in the documentation now.

I also realize that the mentioned state is a GL-core feature, so not restricted to the FFP.

Alternatively we could use a shared GL context (performance loss while switching),
or drop GLSL flip all-together (performance loss).

I close this bug for now (WONTFIX)  - if you like to re-open it to pursue one of the above alternatives
or another (i.e. preserve all the states) .. please do so. I will merge your changes ofc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3028</commentid>
    <comment_count>6</comment_count>
    <who name="Bill Kuker">bkuker</who>
    <bug_when>2013-10-02 16:50:35 +0200</bug_when>
    <thetext>(In reply to comment #5)

I think its fine to not fix it, the problem is confirmed understood and documented, and the workaround is easy. I think it does deserve a mention in the GLJPanel javadoc.

To be honest I&apos;ll choose to be a little selfish and write a one line workaround rather than a patch to save / restore all states.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3645</commentid>
    <comment_count>7</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-01-25 00:38:07 +0100</bug_when>
    <thetext>Just for completeness: Best  GLJPanel solution for performance
and compatibility is GLJPanel&apos;s &apos;setSkipGLOrientationVerticalFlip(true)&apos;,
see Bug 904, and referenced git-sha1 commits (incl. unit tests).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3647</commentid>
    <comment_count>8</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-01-25 00:39:07 +0100</bug_when>
    <thetext>*** Bug 874 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>506</attachid>
            <date>2013-09-26 21:31:58 +0200</date>
            <delta_ts>2013-09-26 21:31:58 +0200</delta_ts>
            <desc>Test case demonstrating this bug.</desc>
            <filename>OneTriangle.java</filename>
            <type>application/octet-stream</type>
            <size>1396</size>
            <attacher name="Mike Zimmerman">afterglow79</attacher>
            
              <data encoding="base64">cGFja2FnZSBqb2dsLmJhc2UudGVzdDsNCg0KaW1wb3J0IGphdmF4Lm1lZGlhLm9wZW5nbC5HTDsN
CmltcG9ydCBqYXZheC5tZWRpYS5vcGVuZ2wuR0wyOw0KaW1wb3J0IGphdmF4Lm1lZGlhLm9wZW5n
bC5nbHUuR0xVOw0KDQpwdWJsaWMgY2xhc3MgT25lVHJpYW5nbGUgew0KICAgIHB1YmxpYyBzdGF0
aWMgdm9pZCBzZXR1cCggR0wyIGdsMiwgaW50IHdpZHRoLCBpbnQgaGVpZ2h0ICkgew0KICAgICAg
ICBnbDIuZ2xNYXRyaXhNb2RlKCBHTDIuR0xfUFJPSkVDVElPTiApOw0KICAgICAgICBnbDIuZ2xM
b2FkSWRlbnRpdHkoKTsNCg0KICAgICAgICAvLyBjb29yZGluYXRlIHN5c3RlbSBvcmlnaW4gYXQg
bG93ZXIgbGVmdCB3aXRoIHdpZHRoIGFuZCBoZWlnaHQgc2FtZSBhcyB0aGUgd2luZG93DQogICAg
ICAgIEdMVSBnbHUgPSBuZXcgR0xVKCk7DQogICAgICAgIGdsdS5nbHVPcnRobzJEKCAwLjBmLCB3
aWR0aCwgMC4wZiwgaGVpZ2h0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