textureproblem

Hi again,

I found out how to tesselate complex polygons, but the textures are mapped per triangle (generated by the Tessfunctions) and not over the whole polygon.
What can I do ? Please help me…

int g_nTexIndex; // number of texturcoord i have to use
GLdouble *g_pdTexCoords; // pairs of generated texturecoords

GLvoid CALLBACK gCallbackVertex(GLdouble pdVertex) // callback for TessVertex()
{
// texturecoord
glTexCoord2d(g_pdTexCoords[g_nTexIndex
2], g_pdTexCoords[g_nTexIndex*2+1]);

// 3d-point
glVertex3dv(pdVertex);

g_nTexIndex++;
}

Try :

int g_nTexIndex; // number of texturcoord i have to use
GLdouble *g_pdTexCoords; // pairs of generated texturecoords

GLvoid CALLBACK gCallbackVertex(GLdouble *pdVertex) // callback for TessVertex()
{
// texturecoord
glTexCoord2d(g_pdTexCoords[g_nTexIndex], g_pdTexCoords[g_nTexIndex+1]);

// 3d-point
glVertex3dv(pdVertex);

g_nTexIndex++;
}

I’ve just deleted the * 2 (2 triangles for making a polygones).

If it’s work, can you send me a example ?

Thanks in advance.

I tried to put the glTexCoord2d() in the callback for the gluTessVertex() and see some sort of effect of a texture, but not the texture itself.
I use an array of five doubles, par vertex: x, y, z, u & v.

Any suggestions?
void CALLBACK vertexCallback(GLdouble vertex[5])
{ glTexCoord2d(vertex[3]*10, vertex[4]*10);
glVertex3d(vertex[0], vertex[1], vertex[2]);
}

Hi,

check the last two values (for the texturecoords) of your pointerarray. I think they have not the values you wish, because the pointer in the callback-function is the same pointer you have to give to the gluTessVertex-function and this pointer only takes three parameters.
This is the reason why i use global variables.
If it works then you must see your textures but then you have the same problem i have - flipping textures which are mapped per triangle.

Please post a message if i was right or not.

Originally posted by ST2000:
If it works then you must see your textures but then you have the same problem i have - flipping textures which are mapped per triangle.

I tried with a global list of coords, like u said but I only see a color effect on the surface. No recognizable pixels! I see the effect of mipmapping though (i guess).

stefkeB