[Mesa-dev] [Bug 51641] New: GLU_TESS_COMBINE callback called with NULL data pointers, conflicting documentation.
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Sun Jul 1 18:51:32 PDT 2012
https://bugs.freedesktop.org/show_bug.cgi?id=51641
Bug #: 51641
Summary: GLU_TESS_COMBINE callback called with NULL data
pointers, conflicting documentation.
Classification: Unclassified
Product: Mesa
Version: 8.0
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: medium
Component: GLU
AssignedTo: mesa-dev at lists.freedesktop.org
ReportedBy: carlchatfield at gmail.com
According to http://www.opengl.org/sdk/docs/man/xhtml/gluTessCallback.xml
(don't know if this is official or not.):
void combine( GLdouble coords[3], void *vertex_data[4],
GLfloat weight[4], void **outData );
All vertex pointers are valid even when some of the weights are 0. coords gives
the location of the new vertex.
The following example code is also given:
void myCombine( GLdouble coords[3], VERTEX *d[4],
GLfloat w[4], VERTEX **dataOut )
{
VERTEX *new = new_vertex();
new->x = coords[0];
new->y = coords[1];
new->z = coords[2];
new->r = w[0]*d[0]->r + w[1]*d[1]->r + w[2]*d[2]->r + w[3]*d[3]->r;
new->g = w[0]*d[0]->g + w[1]*d[1]->g + w[2]*d[2]->g + w[3]*d[3]->g;
new->b = w[0]*d[0]->b + w[1]*d[1]->b + w[2]*d[2]->b + w[3]*d[3]->b;
new->a = w[0]*d[0]->a + w[1]*d[1]->a + w[2]*d[2]->a + w[3]*d[3]->a;
*dataOut = new;
}
Implying that all vertex pointers are indeed valid.
However, in the function
static void SpliceMergeVertices( GLUtesselator *tess, GLUhalfEdge *e1,
GLUhalfEdge *e2 )
/*
* Two vertices with idential coordinates are combined into one.
* e1->Org is kept, while e2->Org is discarded.
*/
{
void *data[4] = { NULL, NULL, NULL, NULL };
GLfloat weights[4] = { 0.5, 0.5, 0.0, 0.0 };
data[0] = e1->Org->data;
data[1] = e2->Org->data;
CallCombine( tess, e1->Org, data, weights, FALSE );
if ( !__gl_meshSplice( e1, e2 ) ) longjmp(tess->env,1);
}
data[3] and data[4] are NULL. Thus if an application expects the pointers to be
valid, they will crash.
A possible fix:
data[0] = data[2] = e1->Org->data;
data[1] = data[3] = e2->Org->data;
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the mesa-dev
mailing list