写了一个贴图的程序,程序运行后出现错误 :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位)。 |
相关文章推荐
- Problem: 程序运行时,出现错误提示 Debug Assertion Failed! Program: d:\Program\Prg.exe File: f:\rtm\vctools\vc7libs\ship\atlmfc\include\afxwin1.inl Line: 24
- QT中运行程序时出现错误“ QApplication: No such file or directory"
- 转 VS2005程序运行时出现MSVCP80D.dll not found错误解决方法(VS 2005的一个“Bug”)
- IOS错误异常一个未知的实例在运行,出现程序崩溃
- Windows下 haoop下运行程序时出现错误:Hadoop HDFS Wrong FS: hdfs:/ expected file:///
- 64bit系统运行32位Web程序出现错误:An attempt was made to load a program with an incorrect format
- C# Tips: 64位操作系统运行P/Invoke程序出现BadImageFormatException错误,错误代码:0x8007000B
- 在部署EasyDarwin流媒体云平台过程中redis运行出现#Unknown RDB format version: 7错误的解决方法
- 运行python程序时出现错误“SyntaxError: Non-ASCII character '\xe8' in file variable.py on line 1, but no encod”
- 在Win7(64位)系统下运行World Wind源码程序出现“未处理BadImageFormatException”错误解决方法(另:附加信息)
- Ubuntu上运行Swt带browser程序出现Unknown Mozilla path (MOZILLA_FIVE_HOME not set)错误
- Qt Creator新安装后运行一个程序后,出现错误:Error while building/deploying project dict-qt (kit: Desktop Qt 5.10.0 MinGW 32bit) When executing step "qmake"
- VB遇到的问题【运行EXE时出现“VB未预期的错误”】【Component ‘RICHTX32.0CX’not correctly registered: file is.....”】
- Image组件加载图片出现错误后如何让程序继续正常的运行?
- 程序运行出现错误:System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded
- OSG编写简单程序,运行出现“应用程序无法正常启动(0xc000000d)”的错误
- 文章标题Ubuntu下运行shell程序出现 declare:not found 错误
- Delphi 开发时运行出现 程序连接数据库错误 在指定的 DSN 中,驱动程序和应用程序之间的体系结构不匹配
- Java使用java命令运行程序出现:找不到主类错误
- android studio在真机上运行程序出现Unsupported major.minor version 52.0错误