Tessellation!

I’m having some problems using tessellation.

I use some code I found on the internet but it gives me no result at all…

	GLUtesselator *tobj;
	cout << "
Creating Map...
";
	GLuint index = glGenLists(1);
	cout << (int) index;
	tobj = gluNewTess();
	gluTessCallback(tobj, GLU_TESS_VERTEX, 
                   (void(__stdcall*)())glVertex3dv);
	gluTessCallback(tobj, GLU_TESS_BEGIN, 
                   (void(__stdcall*)())beginCallback);
	gluTessCallback(tobj, GLU_TESS_END, 
                   (void(__stdcall*)())endCallback);
	gluTessCallback(tobj, GLU_TESS_ERROR, 
                   (void(__stdcall*)())errorCallback);
	gluTessCallback(tobj, GLU_TESS_COMBINE, 
                   (void(__stdcall*)())combineCallback);
		glPushMatrix();
		glClear (GL_COLOR_BUFFER_BIT);
		glColor3f (0.0, 0.0, 1.0);
		int i;
		//Render Polygon Shapefile
		if (minkSumFinal.empty()==0){
			glColor3f(1.0,0.0, 0.0);
			glShadeModel(GL_FLAT);   
			for( i=0;i<(int)minkSumFinal.size();i++)
			{
				if (i%2)
				glColor3f(1.0,0.0,0.0);
				else glColor3f(0.0,0.0,1.0);
				for(int j=0;j<(int)minkSumFinal[i].vMinkSum.size();j++)
				{
					glNewList(index, GL_COMPILE_AND_EXECUTE);
					gluTessBeginPolygon(tobj, 0);
						gluTessBeginContour(tobj);
							for(int k=0;k<(int)minkSumFinal[i].vMinkSum[j].pointList.vPointList.size();k++)
							{
								point[0][0]=minkSumFinal[i].vMinkSum[j].pointList.vPointList[k].dX;
								point[0][1]=0.0;
								point[0][2]=minkSumFinal[i].vMinkSum[j].pointList.vPointList[k].dY;
								gluTessVertex(tobj, point[0], point[0]);
							}
						gluTessEndContour(tobj);
					gluTessEndPolygon(tobj);
					glEndList();
					indexs.push_back(index);
					cout << endl;
					cout << "1. Polygon:
";
					cout << "===============
";
					cout << ss.str().c_str() << endl;
					ss.str("");
				}
			}
		}
		glPopMatrix();	
	gluDeleteTess(tobj);

Any help would be apreciated…

Thanks in advance,

Makinis.

Edit:

Just found some information about this…

Notes
It is a common error to use a local variable for location or data and store values into it as part of a loop. For example:

for (i = 0; i < NVERTICES; ++i) {
   GLdouble data[3];
   data[0] = vertex[i][0];
   data[1] = vertex[i][1];
   data[2] = vertex[i][2];
   gluTessVertex(tobj, data, data);
}

This doesn’t work. Because the pointers specified by location and data might not be dereferenced until gluTessEndPolygon is executed, all the vertex coordinates but the very last set could be overwritten before tessellation begins.

Two common symptoms of this problem are when the data consists of a single point (when a local variable is used for data) and a GLU_TESS_NEED_COMBINE_CALLBACK error (when a local variable is used for location).

@ Here…