Help with texture !

Hi to everyone !

I would like to know hot to map a texture (from a file ) on a polygon drawn with OpenGl.
I have for example an image (.bmp, .jpg…) and i want to use it as texture for a polygon in my opengl application, for example to “cover” the surface of a sphere or a cube. Someone can help me ??

Thanks ,


I recommend that you read these tutorial about texture mapping:

NeHe’s Tutorial 6: Texture Mapping
NeHe’s Tutorial 7: Texture Filters

These are excelent demostrations about OpenGL texture mapping methods (at the bottom of every tutorial page, you have various ports to different platforms).

Of course, you should also read the OpenGL Programming Guide to have a complete understanding of how texture works.