There were 2 problems, I noticed I didn't have all of the dlls in the right places, and I also hadn't input the path correctly. But, even after fixing my blunder, it still crashes upon loading ANY image. I'm on Windows 10.Īs a side note, I did notice that I hadn't escaped my backslashes, and I also didn't use the origin identifier in my path. One question: I see you used '/' instead of '\\', are you on Unix or Linux? That may be the difference. I've never used tif, but I used default settings on save, so. The tif I created just to round my bases. Standard 24bpp true color format for the bmp. 8bpc/32bpp/standard compression for the pngs. I created all files myself, and as a studied graphic artist I highly doubt I did anything wrong with them. I used two different pngs, plus I tried it with a tif and bmp. it seems very It's definitely not the image files. Help would be greatly appreciated, Gaul Thank you. I don't know if there is an error in my code, or if I need libPNG and zlib. Unfortunately, this works very bad under OS X, so i decided not to use DevIL at all, and rewrite the respective parts of the application using another library. This, however, doesn't seem to be the path I needed to take, as through testing BMPs do the same thing(Which SDL Image says should load natively). I have to use existing code which uses the DevIL library for loading JPG and PNG textures. I tried for hours to install those two libraries, but it looks like no matter which archive I download it's just full of UNIX garbage that I can't use on Windows. Id suggest to specify a full path to the file. This function is available since SDLimage 2.0.0. Generally its better to use the abstract interfaces also, there is only an SDLRWops interface available here. If I comment block all the Load Images part it runs(even with the PNG Loading part still in), but if I dont, it exits due to the error.Īfter digging around to see what could be wrong I went to the SDL Image website to read that PNG files may need libPNG and zlib. If you know you definitely have a PNG image, you can call this function, which will skip SDLimages file format detection routines. SDL_Log("Unable to initialize load image: %s", IMG_GetError()) Rwop=SDL_RWFromFile("\media\die.png", "rb") SDL_Log("Unable to initialize image load: %s", IMG_GetError()) Through process of elimination(thanks to my in-built error checking), I have narrowed it down to this code: Yesterday, I tried to install SDL Image, and I have the library installed to the point that CodeBlocks can pick up it's syntax and I can use auto finish on it's commands, and there are no compilation errors. Loading BMPs, editing pixel matrices, getting user input, basic loop timing and flow, etc. I have SDL linked perfectly fine, and have been messing around with it's commands for a couple of days with no problems. I'm using CodeBlocks 17.12, SDL 2.0.8, and SDL Image 2.0.3, and I am trying to load a PNG file in for use as a sprite. I'm comfortable with the C++ syntax already and have been chugging along fine, but I've hit a bit of a snag. If (nullptr = (img = IMG_Load(imagePath.I've been teaching myself C++ for the past week, although I've been coding and tinkering with games for almost 16 years. Std::cout d_name << std::endl << imagePath << std::endl Use SDLSetTextureBlendMode (source, SDLBLENDMODENONE) before RenderCopy, otherwise youll get wrong colour (blended with default black - result would be darker than it shound be). In this function I’m showing the folders of my current directory and I’m make an image load of each folder, if it work it write “worked” else it print an error message. There are two problems: Disable blending. I also correctly linked my libraries, I have pain to understand why, IMG_Load is not able to load my images. This is strange because the file exist, as I you can see in my output. SDL2image is an official extension of SDL 2. These features are obviously not part of native SDL 2.0. Creation of SDL2 texture from image files directly. Supported formats: ICO, CUR, BMP, GIF, JPG, LBM, PCX, PNG, PNM, TIF, XCF, XPM, XV, WEBP. SDL2image.dll libjpeg-9.dll libpng16-16.dll libtiff-5.dll libwebp-7.dll Then my image loaded. It allows: Loading of many common image formats. To load PNGs properly on Windows, SDLimage requires that the libpng and zlib DLLs reside in the same directory as the executable. I have an image called underground.png and when I’m loading it, I’m permanently get the error : “IMG_Load : Failed loading libjpeg-9.dll specified is unfoundable”. If BMP files load and PNG files dont load on Windows, you have a DLL location problem. I have a big problem with IMG_Load function from “SDL_image.h”.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |