PDA

View Full Version : How to do multitexturing and tessellation together



maochenhappy
05-06-2008, 10:03 AM
Hi,

This is the first time that I post the question here. Please point me a direction for the question below. Thanks in advance!

I'm trying to do dot3 bump mapping using OpenGL, where the multi-texturing function is used:
glMultiTexCoord2fARB(GLenum texUnit, TYPE coords)

At the same time, I need to tesselate the textured polygon to render ploygons with holes inside. In this case, I need to use:
gluTessVertex(GLUtesselator* tessobj, GLdouble coords[3], void * vertex_data)

However, I can't find a way to do both together. I can't find a way to fit the glMultiTexCoord2fARB(...) function in the GL tesselation routine and vice versa.

Anyone had the similar problem before or has the ideas to get around it? I have an urgent dealine to meet and must sort this out soon. Any comments will be really appreciated.

Many thanks,

Chen

Komat
05-06-2008, 06:30 PM
You need to register tessellation callback of GLU_TESS_VERTEX type. When that callback is called by the tassellator, it will get the pointer you specified in the vertex_data parameter when you called the gluTessVertex for corresponding vertex. If you use pointer to structure containing texture coordinates of that vertex, the callback can then extract them and call glMultiTexCoord2fARB as necessary.