PDA

View Full Version : TESSELLATION and TEXTURE



02-28-2006, 06:20 AM
i have a porblem. i used a tessellation for draw a polygon and now i would put a texture on the polygon.

i used this code to draw the polygon, in the callback i put this code:


void CALLBACK vertexCallback(const GLvoid *vertex)
{
const tutti *ptr = (const tutti*)vertex;

glTexCoord2f(ptr->x_tex,ptr->y_tex);

glVertex3d(ptr->x_coord1, ptr->y_coord1, ptr->z_coord1);
}

i would like to know why my texture is not placed in polygon even though i put glTexCoord2f before glVertex3d.

i put glEnable(GL_TEXTURE) of course but the texture is no placed.
can someone help me to resolve this problem??
thanks!!

Aeluned
02-28-2006, 07:24 AM
There are a bunch of reasons why your texture may not be visible. The most common error is that your texture is not a power of 2.

Also ensure that the texture has been uploaded to graphics memory properly (glTexImage2D()).

Use glGetError() to ensure everything went smoothly.

Also, I assume you meant glEnable(GL_TEXTURE_2D).