c++ - SDL_Image return NULL when trying to load texture -


i have model loaded screen, having trouble getting it's texture read. whenever try load model's texture, returns null. model , texture resides within same directory, can't figure out why program having problems. while program runs, error receive img_geterror() is:

couldn't open (location)/image.jpg

here how loading:

bool ctexture::load() {     surface = img_load(_filename.c_str());      glenable(gl_texture_2d);     glgentextures(1, &_textureobj);      if (surface == null)     {         std::cout          << "---------------\n"          << img_geterror()          << "\n---------------\n"          << std::endl;          return 0;     }      _width = surface->w;     _height = surface->h;     _bpp = surface->pitch;      if (surface->format->bytesperpixel == 3)         _mode = gl_rgb;      else if (surface->format->bitsperpixel == 4)         _mode = gl_rgba;      else     {         sdl_freesurface(surface);         return false;     }      glbindtexture(_texturetarget, _textureobj);     glteximage2d(_texturetarget, 0, _mode, surface->w, surface->h, 0, _mode, gl_unsigned_byte, surface->pixels);     setfiltering(gl_linear, gl_linear);      _isloaded = true;      if (surface)         sdl_freesurface(surface);      std::cout << _filename << std::endl;      return _isloaded; 

}

my dlls libjpeg-9, libpng16-16, libtiff , libwebp-4.


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -