PDA

View Full Version : gluTessCallback + GLU_TESS_VERTEX



ahuarte
01-09-2003, 01:17 AM
Hello I want define my own GLU_TESS_VERTEX function. I declare "myVertex3dv" function in order to send the vertice array in a step.

I want avoid use ...
for (i = 0; i < iCount; i++) gluTessVertex(tess, (GLdouble *)(pPoints+i), (GLdouble *)(pPoints+i));

I want use ...
glVertexPointer(3, GL_DOUBLE, 0, (const GLdouble *)&(pPoints+0)->x);

Then I setup the tesselator object, but my "myVertex3dv" function is not called.
How I do??

Thank you very much.


GLUtesselator * tess = gluNewTess();
gluTessCallback(tess, GLU_TESS_BEGIN, (tptrf)glBegin);
gluTessCallback(tess, GLU_TESS_VERTEX, (tptrf)myVertex3dv);
gluTessCallback(tess, GLU_TESS_EDGE_FLAG, (tptrf)glEdgeFlag);
gluTessCallback(tess, GLU_TESS_END, (tptrf)glEnd);

gluTessBeginPolygon(tess, NULL);
gluTessBeginContour(tess);
//->for (i = 0; i < pElement->Geom.NumPoints; i++) gluTessVertex(tess, (GLdouble *)(pElement->Geom.pPoints+i), (GLdouble *)(pElement->Geom.pPoints+i));
gluTessVertex(tess, (GLdouble *)(pElement->Geom.pPoints), pElement->Geom.pPoints);
gluTessEndContour(tess);
gluTessEndPolygon(tess);

glFlush();
gluDeleteTess(tess);

void APIENTRY CALLBACK myVertex3dv(_3DPoint * pPoints)
{
glVertexPointer(3, GL_DOUBLE, 0, (const GLdouble *)&(pPoints+0)->x);
}