1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| bool __fastcall TForm1::LoadTexture(char* sFilename, GLuint* pID)
{
BMPTexture* BMPTex = OpenGLAPPanel1->LoadBMPTexture(sFilename, false);
if(!BMPTex)
return false;
glGenTextures(1, pID);
glBindTexture(GL_TEXTURE_2D, *pID);
glTexImage2D(GL_TEXTURE_2D, 0, 3, BMPTex->GetWidth(),
BMPTex->GetHeight(), 0, BMPTex->Format,
BMPTex->Type, BMPTex->GetPixels());
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
delete BMPTex;
return true;
} |
Partager