Soil image loader

can someone tell me the best way they used to load an image using soil library.. i've been trying so long now.. can show me an implementation that worked for them using the soil library.. every step of it... i haved already mapped it properly but nothing neva appears... here's mines so far but nothing...

[code
GLuint LoadImage()
{

int width, height;
unsigned char* img = SOIL_load_image("Terrain.png", &width, &height, NULL, 0);

if(texture == 0)
return false;


// Typical Texture Generation Using Data From The Bitmap
glGenTextures(1 , &texture[0]); // allocate a texture name
glBindTexture(GL_TEXTURE_2D, texture[0]);
// select modulate to mix texture with color for shading
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
//glTexImage2D(GL_TEXTURE_2D, 0, 3, texture, texture, 0, GL_RGB, GL_UNSIGNED_BYTE, texture);
// texture settings for large area
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_NEAREST_MIPMAP_LINEAR, GL_LINEAR);
// the texture wraps over at the edges (repeat)
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, img);

// build our texture mipmaps
gluBuild2DMipmaps( GL_TEXTURE_2D, 3, width, height,
GL_RGB, GL_UNSIGNED_BYTE, img );


free(img);

return texture[0];

}

][/code]
im using a white object to put texture over.. jus saying
Topic archived. No new replies allowed.