View Full Version : Displaying tesselation objects

01-22-2006, 04:45 AM

I'm using the following code to tesselate a polygon (after defining tobj and registering the callback functions).

tobj = gluNewTess();

for(VertexNum = 0; VertexNum < NumOfVertices; VertexNum ++) {
CoOrdinates[0] = (GLdouble)X;
CoOrdinates[1] = (GLdouble)Y;
CoOrdinates[2] = (GLdouble)0.0;
gluTessVertex(tobj, CoOrdinates, CoOrdinates);
gluEndPolygon(tobj);It doesn't create error messages, but nor does it actually show anything on the screen. Could anyone tell me how to make it draw?



01-22-2006, 10:08 PM
It can be many reasons for this, have you setup the viewport, projectoin and modelview matrix ?

You say that you have setup the callbacks, in that case what are they doing ?

Check for errors after you have called the tesselation functions is also a good thing if you don't get it to work.


01-23-2006, 02:12 AM

I don't really understand the role of the matrix modes. At the moment by window reshape function contains:

glViewport(0, 0, (GLsizei)WindowWidth, (GLsizei)WindowHeight);
glOrtho(0.0, (GLdouble)WindowWidth, (GLdouble)WindowHeight, 0.0, 1.0, -1.0);

And that's all I've done to format the window. The call to glMatrixMode there is the only one in my program. You refered to a projection matrix and a modelview matrix. I don't know why I'd need these two modes, or how I would implement that. Any help is very much appreciated.



01-23-2006, 04:51 AM
With the default modelview matrix you will have the "camera" located at 0,0,0 and then you render your polygon with a Z value of 0, so is why you do not see anything.

Have a look at any OpenGL example how to use the modelview matrix, the simplest way is to select the modelview matrix and the do translate Z away from 0 a bit.

gluLookAt is another way to setup the "camera", but as I said, have a peek at some OpenGL examples at NeHe or what ever to find out how to use the modelview matrix.