PDA

View Full Version : Tesselatio problem on Windows NT



MarcoPif
02-17-2000, 11:29 PM
Could someone, please, check why the following small program is crashing ?
The point passed are the external outline of a uppercase 'A'.

Thanks,

Marco Pifferi

N.B.: I am compiling it on Windows NT with DevStudio 6.0

#include <stdio.h>
#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>

typedef void (__stdcall *FunctionCallback)(void);

void Error(GLenum error)
{
printf("Errore \"%s\" \n",gluErrorString(error));
}

void Begin(GLenum type)
{
switch(type)
{
case GL_TRIANGLES:
printf("Type Triangles\n");
break;
case GL_TRIANGLE_STRIP:
printf("Type Triangle Strip\n");
break;
case GL_TRIANGLE_FAN:
printf("Type Triangle Fan\n");
break;
default:
printf("Type unknown\n");
break;
}
}

void Vertex(void *data)
{
GLdouble *Pnt = (GLdouble *)data;
printf("%lg, %lg, %lg\n");
}

void End(void)
{
printf("End\n");
}

int main(int argc, char* argv[])
{
GLUtesselator *Tess;
GLdouble Pnt1[3],Pnt2[3],Pnt3[3],Pnt4[3],Pnt5[3],Pnt6[3],Pnt7[3],Pnt8[3];

Tess = gluNewTess();

gluTessCallback(Tess,GLU_TESS_BEGIN ,(FunctionCallback)Begin);
gluTessCallback(Tess,GLU_TESS_VERTEX ,(FunctionCallback)Vertex);
gluTessCallback(Tess,GLU_TESS_END ,(FunctionCallback)End);
gluTessCallback(Tess,GLU_TESS_ERROR ,(FunctionCallback)Error);


gluTessBeginPolygon(Tess,NULL);
gluTessBeginContour(Tess);

Pnt1[0] = -49.6485;
Pnt1[1] = 39.0314;
Pnt1[2] = 0;
gluTessVertex(Tess,Pnt1,Pnt1);

Pnt2[0] = -46.1212;
Pnt2[1] = 47.5314;
Pnt2[2] = 0;
gluTessVertex(Tess,Pnt2,Pnt2);

Pnt3[0] = -45.3243;
Pnt3[1] = 47.5314;
Pnt3[2] = 0;
gluTessVertex(Tess,Pnt3,Pnt3);

Pnt4[0] = -41.797;
Pnt4[1] = 39.0314;
Pnt4[2] = 0;
gluTessVertex(Tess,Pnt4,Pnt4);

Pnt5[0] = -42.8477;
Pnt5[1] = 39.0314;
Pnt5[2] = 0;
gluTessVertex(Tess,Pnt5,Pnt5);

Pnt6[0] = -43.8048;
Pnt6[1] = 41.5314;
Pnt6[2] = 0;
gluTessVertex(Tess,Pnt6,Pnt6);

Pnt7[0] = -47.6407;
Pnt7[1] = 41.5314;
Pnt7[2] = 0;
gluTessVertex(Tess,Pnt7,Pnt7);

Pnt8[0] = -48.5977;
Pnt8[1] = 39.0314;
Pnt8[2] = 0;
gluTessVertex(Tess,Pnt8,Pnt8);

gluTessEndContour(Tess);
gluTessEndPolygon(Tess);

gluDeleteTess(Tess);

return 0;
}