#include <GL/glut.h>

unsigned char TRICOLOR[3] = {64, 128, 194};

void display()
{
  glViewport( 0, 0, 300, 300 );

  glMatrixMode( GL_MODELVIEW );

  glDepthFunc( GL_LEQUAL );
  glEnable( GL_DEPTH_TEST );

  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
  glEnable( GL_BLEND );

  glDrawBuffer( GL_BACK );
  glViewport( 0, 0, 300, 300 );

  glMatrixMode( GL_PROJECTION );
  glPushMatrix();
  double d1[16] = {    3.73,        0.00,        0.00,        0.00, 
                       0.00,        3.73,        0.00,        0.00, 
                       0.00,        0.00,       -1.00,       -1.00, 
                       0.00,        0.00,       -0.02,        0.00 };
  glLoadMatrixd(  d1 );

  glMatrixMode( GL_MODELVIEW );
  glPushMatrix(  );
  double d2[16] = {   1.00,        0.00,        0.00,        0.00, 
                      0.00,        1.00,        0.00,        0.00, 
                      0.00,        0.00,        1.00,        0.00, 
                      -1.50,        0.75,       -7.00,        1.00 };
  glMultMatrixd( d2 );

  glClearColor( 0.000000, 0.000000, 0.000000, 0.000000 );
  glClearDepth( 1.000000 );
  glClear( 0x4100 );

  glDisable( GL_MULTISAMPLE );
  glDisable( GL_LIGHTING );
   
  glBegin( GL_POLYGON );
  glColor3ubv( TRICOLOR );
  float arr1[3] = {0.853553, -1.500000, 0.353553};
  glVertex3fv( arr1 );
  float arr2[3] = {0.609254, -1.163751, 0.353553};
  glVertex3fv( arr2 );
  float arr3[3] = {0.500000, -1.500000, 0.500000};
  glVertex3fv( arr3 );
  glEnd(  );

  glutSwapBuffers();
  glFlush(  );
  glGetError(  );

  glMatrixMode( GL_PROJECTION );
  glPopMatrix();
  glMatrixMode( GL_MODELVIEW );
  glPopMatrix();

}

int main(int ac, char **av)
{
  glutInit(&ac, av);
  glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH );
  glutInitWindowSize( 300,300);
  glutCreateWindow( "GL trace");
  glutDisplayFunc(display);
  glutMainLoop();
}


On 10/16/06, Brian Paul <brian.paul@tungstengraphics.com> wrote:
Ulrich von Zadow wrote:
> Brian Paul wrote:
>
>>Dave Demarle wrote:
>>
>>>Howdy,
>>>
>>>Okay, heres the bug in two parts.
>>>part 1) I forget to turn of GL_BLEND while I do selection.
>>>My bad - DOH!
>>>
>>>part2) The blending function glBlendFunc( GL_SRC_ALPHA,
>>>GL_ONE_MINUS_SRC_ALPHA ) - gets applied and ends up producing the wrong
>>>results.
>>>
>>>The destination fragment is:
>>>0,0,0,0 (background)
>>>The source fragment is:
>>>X,Y,Z,1 (my triangle)
>>>The resulting color is:
>>>(X*1+0*(1-1),(Y*1+0*(1-1),(Z*1+0*(1-1),(1*1+0*(1-1))
>>>which should end up being
>>>X,Y,Z,1
>>>but ends up being
>>>X-1,Y-1,Z-1,1
>>>Not my bad - phew, maybe this wasn't a total waste of your time. :)
>>
>>I doubt there's a bug in Mesa's blend code.  That's a very commonly
>>used mode.  No one else has reported a such a bug and several blending
>>conformance tests are known to pass.
>>
>>Can you post a small test program that shows the problem?
>
>
> I'm pretty sure I've also seen something like this - Mesa 6.4.x on a VIA
> EPIA. There was a small but visible difference between fragment alpha=1
> in an RGBA texture and just using an RGB texture. We were using
> glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) and using a 16-bit
> video mode. Vertex color was (1,1,1,1).

Was that using the via hardware driver?  I believe Dave is using the
software Xlib driver.

-Brian

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mesa3d-users mailing list
Mesa3d-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-users