SDL_Surface* image = IMG_Load("tex.png");
SDL_Surface* tmp = SDL_DisplayFormat(image);
SDL_FreeSurface(image);
image = tmp;
SDL Issues [solved]
I'm using Visual Studio 2005 Beta 2 with the latest stable release of SDL and SDL_image. When I use IMG_Load() to load an image and then attempt to use SDL_DisplayFormat() to get the image into the display format for faster blitting, i get an error saying...
Unhandled exception at 0x1002706f (SDL.dll) in TINQ DX.exe: 0xC0000005: Access violation reading location 0x00000000.
The offending piece of code is as follows.
Any ideas ?
[Edited by - neodingo on June 9, 2005 10:54:45 AM]
The most likely cause is that the IMG_Load() function is failing and, therefore, returning NULL. Then you pass NULL to SDL_DisplayFormat() and get the exception. If you check the return value from IMG_Load(), you can catch the error before calling SDL_DisplayFormat().
It is probably just a case of the current directory when executing the application not being where the image file is actually stored.
It is probably just a case of the current directory when executing the application not being where the image file is actually stored.
Yes, if ur coming from a Dev-C++ environtment, ur dirctories had to be relative to the excutable. But in VC7(not sure about 8) the files are relative to the project file, not the executble(which would be like Debug or Release folder which si where u don't want ur images to be).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement