Hi
im developing a personal minilib, and im trying to load and draw a sprite bitmap, i already searched on google...but not worked.
im want to use ONLY opengl(gl/gl.h) without libs like glu,glaux,etc...

can someone help me?

my code:

Code :
GLuint loadBMP_custom(const char * imagepath)
{
unsigned char header[54];
unsigned int dataPos;
unsigned int width, height;
unsigned int imageSize;
unsigned char * data;
FILE * file = fopen(imagepath,"rb");
if (!file){MessageBoxA(0,"FALHA AO ABRIR A MERDA","",MB_OK); return 0;}
if ( fread(header, 1, 54, file)!=54 ){ // If not 54 bytes read : problem
    MessageBoxA(0,"Arquivo Incorreto","",MB_OK);
    return false;
}
if ( header[0]!='B' || header[1]!='M' ){
    MessageBoxA(0,"Incorreto","",MB_OK);
    return 0;
}
dataPos    = *(int*)&(header[0x0A]);
imageSize  = *(int*)&(header[0x22]);
width      = *(int*)&(header[0x12]);
height     = *(int*)&(header[0x16]);
if (imageSize==0)    imageSize=width*height*3;
if (dataPos==0)      dataPos=54;
data = new unsigned char [imageSize];
fread(data,1,imageSize,file);
fclose(file);
GLuint textureID;
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
 glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,GL_MODULATE );
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR );
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR );
    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_BGR_EXT, GL_UNSIGNED_BYTE, data);
 
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
return(textureID);
}