Bug 14798

Summary: glClear has no effect on a color buffer with an alpha channel in software mesa
Product: Mesa Reporter: francois.bertel
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description francois.bertel 2008-03-03 14:57:56 UTC
OS: Linux gentoo, kernel 2.6.19-gentoo-r5

Using the software renderer of mesa, starting at id ff73c783cc47361ff0dd819c82d067b4b85870dd , 

Take the source of mesa/progs/demos/renormal.c

1. Add glClearColor(0.0,0.5,0.0,0.0); at line 32:

   GLfloat scale = 0.6 + 0.5 * sin(Phi);
   glClearColor(0.0,0.5,0.0,0.0);
   glClear( GL_COLOR_BUFFER_BIT );

2. Run renormal, the background is green, so far so good.

3. Change 
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
to
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA );

4. Run renormal again, the background is black and the yellow sphere is
accumulated frame after frame, glClear() obviously does not work in this case.

Note that I added the glClearColor to make the bug more obvious. You have the
same bug without this line. The problem is really because of the GLUT_ALPHA
statement.


This example works fine with the previous id:

9f6022d0567dc1288888212d7128acc48795b306

Note that this matches the day when the depth peeling algorithm started to fail on the VTK dashboard. In VTK, depth peeling requires to have an alpha component in the framebuffer. 

http://www.vtk.org/Testing/Sites/hythloth.kitware/Linux-gcc41/20080107-0300-Nightly/Results/__Rendering_Testing_Cxx_TestOpacity.html
Comment 1 Brian Paul 2008-03-09 17:14:55 UTC
Hmmm, I modified renormal.c as described but it runs fine for me.
I'll poke around and see if can find another way to test alpha-clearing.
Comment 2 Brian Paul 2008-03-09 17:31:22 UTC
OK, I think I found/fixed the problem after reviewing the commit named below.
Please try the latest code in git.
Comment 3 francois.bertel 2008-03-09 18:36:49 UTC
Your fix with SHA1 ID 810e0549afad45469bef532c1f2d355f3fde0bbb works. It both fixed the issue with the modified renormal.c and the VTK regression tests related to depth peeling. Thanks!
Comment 4 Adam Jackson 2009-08-24 12:29:32 UTC
Mass version move, cvs -> git

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.