Okay, in my last update, I mentioned I had this demo working. Of
course, I had to hack the combine callback, 'cos it was causing serious
memory errors. But, when I replaced this with an inline malloc
everything worked fine.
So, I've spent the better part of a week hunting through my memory
allocation/deallocation trying to find out what was going wrong, all to
no avail.
Today, I decided to look at book/tess.c a little closer. This is one of
those moments you want to just cry - book/tess.c has a bug (and it's
even in the Red Book as well...) that will overflow the malloc'ed
array. And, of course, when this is fixed my code works beautifully...
Here's the offending book/tess.c code:
...
void CALLBACK combineCallback(GLdouble coords[3],
GLdouble *vertex_data[4],
GLfloat weight[4], GLdouble **dataOut )
{
GLdouble *vertex;
int i;
vertex = (GLdouble *) malloc(6 * sizeof(GLdouble));
vertex[0] = coords[0];
vertex[1] = coords[1];
vertex[2] = coords[2];
for (i = 3; i < 7; i++)
vertex[i] = weight[0] * vertex_data[0][i]
+ weight[1] * vertex_data[1][i]
+ weight[2] * vertex_data[2][i]
+ weight[3] * vertex_data[3][i];
*dataOut = vertex;
}
...
Notice the "malloc(6 * blah)" and the "i < 7"...
Oh well :) So, my winding rule code now works. I'll remove all of my
special malloc/free handling and should be ready to commit later today.
Too much fun...
-- Gareth
_______________________________________________
Mesa-dev maillist - [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev