Miklós Fazekas wrote:
>
> 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,
Sorry I didn't get back to you earlier on this. The overflow handling
is complicated by culling which uses projected clip-space coordinates.
This is what is stored in CopyClip, which might better be called
CopyProj to indicate that the perspective divide has been done on these
coordinates.
The code in vbcull.c is what figures out whether there are 'straddling'
cases which need to be copied, such as the one you exercise in your
program. The routines such as 'gl_copy_first_and_last',
'gl_copy_overflow', etc. handle all the cases for each primitive type,
and are found in an array of function pointer, indexed on primitive.
These routines also fill in the 'Copy' array which tells the main vertex
copying routines (in vbxform.c) what vertices need to be copied.
The bug you found arose because I neglected the possibility that
GL_LINE's could straddle the vb, and left the entry for lines in those
arrays as zero. I've committed that fix now, as well as renaming
CopyClip to something less ambiguous.
You are right to say this is confusing - it is unnecessarily complex &
cleaning it up is on my 'todo' list.
Do you have a demo for the QUADS/TRI case?
Keith
_______________________________________________
Mesa-dev maillist - [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev