您的位置:首页 > 其它

写了一个贴图的程序,程序运行后出现错误 :unknown dib file format

2012-03-30 21:30 567 查看
问题解决了,是DIB问题,我采用位图位数不统一,有8位,也有24位,把8位改为24位后又能贴
AUX_RGBImageRec *LoadBMP(char *Filename)    // Loads A Bitmap Image{FILE *File=NULL;         // File Handleif (!Filename)          // Make Sure A Filename Was Given{return NULL;         // If Not Return NULL}File=fopen(Filename,"r");       // Check To See If The File Existsif (File)           // Does The File Exist?{fclose(File);         // Close The Handlereturn auxDIBImageLoad(Filename);    // Load The Bitmap And Return A Pointer}return NULL;          // If Load Failed Return NULL}
int LoadGLTextures()         // Load Bitmaps And Convert To Textures{int Status=FALSE;         // Status IndicatorAUX_RGBImageRec *TextureImage[1];     // Create Storage Space For The Texturememset(TextureImage,0,sizeof(void *)*1);            // Set The Pointer To NULL// Load The Bitmap, Check For Errors, If Bitmap's Not Found Quitif (TextureImage[0]=LoadBMP("Data/Ne.bmp")){Status=TRUE;         // Set The Status To TRUEglGenTextures(1, &texture[0]);     // Create The Texture我把Nehe第六课的代码中的图片换成了自己的头像,然后出现了这个问题。问了别人,才知道我直接把jpg的格式改为bmp格式就加载上去是好傻的事情。应该使用画图板打开png或者jpg,然后另存为bmp(24位)。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐