OS Ubuntu; IDE Codeblocks i wrote my own texture manager class with 'load' function
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;
}
And it writes "IMAGE LOAD ERROR: unsupported image format"
But i included all SDL_image requires:
#include <png.h>
#include <zlib.h>
and without this textureloader IMG_load() worked normally. What is that? and how can i repair it?
You don't need to include these headers, only SDL_image
Did you initialize it? e.g.
/*! initialize PNG support */
IMG_Init(IMG_INIT_PNG);