Hello!

Here is a program which demonstrates a bug in Mesa 3.1beta2. (It's in latest
CVS also.) I've tried it with FX defined  (ie. VB_SIZE=72).

It draws a series of lines, then a point then a series of lines again.
When it overflows the VB, the line falls on half boundary of the vertex
buffer. Ie. the first vertex of the line is the last one in the VB, while
the second vertex of the line is the first of the next VB. This seems to be
causing troubles to Mesa.
Pressing the key 'a' will flush the VB (by calling glLineWidth, so it will
be rendered correctly.

There are also problems when one uses GL_QUADS+GL_TRIANGLES.

I've tried to look at the Mesa sources, but the handling of VB overflows
isn't clear to me.
As i've understood in gl_reset_vb, we copies the remaining vertices of the
previous VB, to the first vertices of the next VB.

But other times (such in: gl_cull_vb). We are copying from CopyClip to the
first elements of VB. (Here is another problem because sometimes we don't
initalize the CopyClip, before copying from it.)

Can anyone describe me, how should the VB-overflow-handling work?


Miklos.



#include <stdlib.h>
#include "glut.h"

GLboolean g_line = GL_FALSE;


void bug_draw(void)
{
 int i;
 glLineWidth(1.0);

 glColor3f(1.0,0.0,0.0);
 glBegin(GL_LINES);
  for (i = 219; i <= 270; i++)
  {
     glVertex2f(140,((float)i)+0.5);
      glVertex2f(200,((float)i)+0.5);
  }
 glEnd();

 glColor3f(0.0,1.0,0.0);
 glBegin(0);
  glVertex2f(0.0,0.0);
 glEnd();

 if (g_line)
 {
  glLineWidth(2.0);
 }

 glBegin(1);
 glColor3f(0,0,1.0);
 {
  int i;
  for (i = 223; i <= 280; i++)
  {
   glVertex2f(100,((float)i)+0.5);
   glVertex2f(110,((float)i)+0.5);

   glVertex2f(410,((float)i)+0.5);
   glVertex2f(420,((float)i)+0.5);
  }
 }

 glEnd();
}
static void
keyboard(unsigned char ch, int x, int y)
{
   if (ch== 'a')
   {
    glutPostRedisplay();
    g_line = !g_line;
   }
}
static void
reshape(int w, int h)
{
  glViewport(0, 0, w, h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(0, w, 0, h, -1, 1);
}
void display(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 bug_draw();
    glFlush();
}




int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize (800, 600);
    glutCreateWindow (argv[0]);
    glutKeyboardFunc(keyboard);
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutMainLoop();
    return 0;
}





_______________________________________________
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev

Reply via email to