IMG_Load故障(不支持图像格式)
IMG_Load troubles (unsupported image format)
操作系统Ubuntu;IDE代码块我编写了自己的纹理管理器类,带有"加载"功能
bool TextureManager::load(std::string fileName, std::string id, SDL_Renderer* pRenderer)
{
SDL_Surface* pTempSurface = IMG_Load(fileName.c_str());
if(pTempSurface == NULL) {
printf("IMAGE LOAD ERROR: %s n", IMG_GetError());
return false;
}
SDL_Texture* pTexture = SDL_CreateTextureFromSurface(pRenderer, pTempSurface);
SDL_FreeSurface(pTempSurface);
// everything went ok, add the texture to our list
if(pTexture != 0) {
m_textureMap[id] = pTexture;
return true;
}
// reaching here means something went wrong
return false;
}
它写着"图像加载错误:不支持的图像格式"
但我包含了SDL_image所需的所有内容:
#include <png.h>
#include <zlib.h>
没有这个texturereloader,IMG_load()正常工作。那是什么?我该怎么修?
您不需要包括这些标头,只需要SDL_image
你初始化它了吗?例如
/*! initialize PNG support */
IMG_Init(IMG_INIT_PNG);
相关文章:
- 将"打开的CV图像"中的"颜色"转换为整数格式
- 将RGB图像保存为PPM格式
- 如何在 OpenCV c++ 中压缩 TIFF 格式的图像?
- 将 BGR 图像转换为 jpeg 格式的 base64 字符串
- QImage:加载图像时自动检测格式
- 如何将 2d 数组转换为 svg 或 png 格式的数独图像?
- TensorFlow图像识别输出格式C
- 图像的像素格式始终返回 32 位
- 如何使用我的C程序将PDF转换为图像格式(jpeg,png,..)
- CGIMAGE:支持的图像格式列表
- 自定义图像格式的奇怪OpenCV问题
- 如何静态链接WebKit的Qt图像格式插件
- 在WINDOWS上写BMP图像格式错误
- zbar::Image::Image() 接受除"Y800"以外的哪些图像格式?
- 如何保持原始图像格式时插入到一个CRichEditCtrl
- 如何检查扫描仪支持的图像格式
- 12位图像格式与c++ API
- IMG_Load故障(不支持图像格式)
- 图像格式转换opencv
- c++位图资源(RT_BITMAP)和PNG图像格式