Loading files in a for routine
I want to texture the cube in lesson 6 with several different textures, so i made a for routine. here is my code(only a part),
so how can i open the bmp, when i named the bmps 1, 2, 3... 6.?
for(int i = 0;i<6;i++)
{
THATS THE PART I WONT TO KNOW:
if (TextureImage=LoadBMP("Data/i.bmp"))
{
Status=TRUE; 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);
}
if (TextureImage) {
if (TextureImage->data) {
free(TextureImage->data); }
free(TextureImage); }
return Status; }
} </i>
u wouldnt understand a german quote :)
char path[64]; //the buffer to hold the stringsprintf(path, "Data/%d.bmp", i);if(TextureImage[ i ]=LoadBMP(path))... etc
this turns path into Data/i.bmp basically, and then passes it to the loadbmp..
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement