have a problem about texture mapping??

I’d like to paste the texture over the wireframe model, but I’ve tried many ways, there’s only color changed on mesh, no texture within the grid. Anyone know where the problem is? Thank you in advance.

Have you enabled texturing?

yes,i am sure that i have done every thing that must to do.(ex:loadBmp,loadTexture,glGenTextures,glBindTexture,glTexCoord2f)…but it still don’t work???
here is my code:
1.loadTexture…

TextureImage=LoadBMP(“pot4.bmp”)
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage->sizeX, TextureImage->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexEnvi(GL_TEXTURE_2D,GL_TEXTURE_ENV_MODE, GL_MODULATE);

2.use Texture…

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture);

glBegin(GL_QUADS);
glTexCoord2f(0.0,0.0);glVertex3f(10,20,10);
glTexCoord2f(1.0,0.0);glVertex3f(20,20,20);
glTexCoord2f(1.0,1.0);glVertex3f(10,20,30);
glTexCoord2f(0.0,1.0);glVertex3f(20,20,30);
glEnd();

and i draw it in a Dialog…

I am not really sure but I think that to have a textured surface you will have to switch the mode from drawing wire frame to drawing solid. glPolygonMode( GL_FRONT, GL_FILL );
If this is not helpful just ignore it,

Fringe

Does your texture’s width and height match 2^a x 2^b (i.e. 64x256) ?

Do you share the textures if you are using several contexts?

Originally posted by fringe:
[b]I am not really sure but I think that to have a textured surface you will have to switch the mode from drawing wire frame to drawing solid. glPolygonMode( GL_FRONT, GL_FILL );
If this is not helpful just ignore it,

Fringe[/b]

i will try it,thank you very much!

Originally posted by Liquid:
Does your texture’s width and height match 2^a x 2^b (i.e. 64x256) ?

yes,it is 256x256…

Originally posted by Zico:
Do you share the textures if you are using several contexts?

sorry, i am not sure that i understand what you mean,can you explain it again! thanks a lot!

I guess you know if you are using more than one context so skip the above.

Texturing works ok in wireframe mode…
The problem is probably in the the LoadBMP/glTexImage2D calls. Check for errors!

i have solved this problem! i am so thank you to every one who help me ! thank you again!