GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: Add Line Numbers


A Paste by Anonymous
bool LoadTexture(char *who, int numtex)
{
char file[50] = "";
strcat(file, who);

FILE *f = fopen(file, "rb"); 

if (f) 
{ 
// Raw 200x200, 24 bits
fread(buffer, 200*200*3, 1, f); 
fclose(f); 

glBindTexture(GL_TEXTURE_2D, numtex);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 200, 200, GL_RGB, GL_UNSIGNED_BYTE, buffer);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
       
    }
else
{
return false;
}
return true;
}