Below is a very simple code that draws 20K of very narrow translucent triangles.
glShadeModel(GL_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 1/255.0f);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, (GLfloat)width/(GLfloat)height, 0.1f, 200.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0f, 0.0f,-199.0f);
glRotatef(-3, 0.0f, 0.0f, 100.0f);
srand(123);
float x1 = -80;
float x2 = 80;
float y1 = -75;
float y2 = -75;
float dx1, dx2, dy1, dy2;
float d = 10000;
glBegin(GL_TRIANGLES);
for(int i = 0; i < int(d); i++)
{
dy1 = ((rand() & 0xFF) + 10) / d;
dy2 = ((rand() & 0xFF) + 10) / d;
dx1 = dy1/2;
dx2 = dy2/2;
glColor4d(1, 0, 0, 0.5);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glVertex2f(x2-dx2, y2+dy2);
glVertex2f(x2-dx2, y2+dy2);
glVertex2f(x1+dx1, y1+dy1);
glVertex2f(x1, y1);
y1 += dy1;
y2 += dy2;
x1 += dx1;
x2 -= dx2;
}
glEnd();
The triangles are all CCW and they can’t overlap just by design. There are no T-junctions either. But the triangles are very narrow and have a slight slope. On my ATI FireGL Mobility I see a lot of sand pixels, with changing pattern when rotating. On nVidia it’s all perfect, no matter how you rotate or resize it. I use red color over black background, with 0.5 opacity. When pixels from different triangles overlap (painted twice) there are sands appear.
Does it mean ATI has stitcing problems? It looks like it does. Can someone comment it?
http://antigrain.com/stuff/narrow_tranlucent_triangles_ati.png
http://antigrain.com/stuff/narrow_tranlucent_triangles_nvidia.png