Texture Mapping

What is an easy way to texture map? I’ve tried nehe’s tutorial on texture mapping but he has alot of filechecking and other coding I don’t follow and don’t really need. I’m just looking for something simple that will load the file so I can use it to map some rectangles.

well assuming you can load your file, whatever it may be, then you just put it to vid memory and bind it to your object with texture coords. if you can do the nehe tut then you should be able to pick the bits of code out that you need.

Look at my code in the program called GLblackjack on my web site.
http://www.angelfire.com/linux/nexusone/

It has a very simple example of loading a texture to a quad, I use two files called tgaload.c and tgaload.h.
Include these in your project settings and this code in your program:

GLint texture;

void load_texture(void)
{
image_t temp_image;

glEnable( GL_TEXTURE_2D );

glPixelStorei( GL_UNPACK_ALIGNMENT,1 );
glGenTextures( 1, texture ); // number of textures to create.

glBindTexture( GL_TEXTURE_2D, texture );

glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
tgaLoad( "filename", &temp_image, TGA_FREE | TGA_LOW_QUALITY );

}

Originally posted by ltrain_riders:
What is an easy way to texture map? I’ve tried nehe’s tutorial on texture mapping but he has alot of filechecking and other coding I don’t follow and don’t really need. I’m just looking for something simple that will load the file so I can use it to map some rectangles.