Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [MacOS X | SFML 1.5] Failed to create image.  (Read 5110 times)

0 Members and 1 Guest are viewing this topic.

fzn

  • Newbie
  • *
  • Posts: 16
    • View Profile
[MacOS X | SFML 1.5] Failed to create image.
« on: July 12, 2009, 03:37:02 pm »
Hey, I think they may be a bug with sf::Image.

Code: [Select]

#include "SFML/Graphics.hpp"

int main(int argc, char *argv[])
{
puts("Loading items.jpg");
sf::Image img;
img.LoadFromFile("data/images/items.jpg")? puts("Okay"): puts("Oops");
}


Output:
Code: [Select]

Loading items.jpg
Failed to create image, its internal size is too high (256x128)
Oops


I'm on 10.5.7, linking with SFML-1.5 release.

Where it happens:

Original image (PNG + Alpha, 192x96 px),
Alpha-stripped PNG file,
JPG conversion of the file,
BMP conversion of the file,
JPG conversion of a resized version of the latter JPG file (forming a 192*192 image).

Where it doesn't happen:

data/images/icon.bmp: PC bitmap data, Windows 3.x format, 32 x 32 x 32


Edit:
I've posted the C++ source files and sample images in a tar.bz2 archive here:
http://dl.free.fr/pMt4Ojceo

Edit2:
Everything works well on win32-mingw or gnu/linux-gcc...

Daazku

  • Hero Member
  • *****
  • Posts: 896
    • View Profile
[MacOS X | SFML 1.5] Failed to create image.
« Reply #1 on: July 12, 2009, 05:28:25 pm »
There is 20 topics in the forum that explain why this error occur.

It's just because your graphics card can't handle an image of this size.
Pensez à mettre le tag [Résolu] une fois la réponse à votre question trouvée.
Remember to add the tag [Solved] when you got an answer to your question.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[MacOS X | SFML 1.5] Failed to create image.
« Reply #2 on: July 12, 2009, 06:25:21 pm »
No, I think this is the known bug on Mac OS X (256 x 128 looks too small for a driver limitation).
Laurent Gomila - SFML developer

fzn

  • Newbie
  • *
  • Posts: 16
    • View Profile
[MacOS X | SFML 1.5] Failed to create image.
« Reply #3 on: July 12, 2009, 06:27:02 pm »
Laurent, do you have information/pointer concerning this bug?

(The machine is fitted with an NVIDIA GeForce 9600M GT, I think the images ain't too large for it.)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[MacOS X | SFML 1.5] Failed to create image.
« Reply #4 on: July 12, 2009, 06:33:12 pm »
No, but I think that Ceylo (who's maintaining the Mac OS X port) will come and tell you more about it.
Laurent Gomila - SFML developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
[MacOS X | SFML 1.5] Failed to create image.
« Reply #5 on: July 13, 2009, 12:08:04 am »
Yes I've already been told about this bug, and I've been looking for a reason for the past few days (maybe 15 days now) but I still can't find why it happens.

However I hadn't been able to reproduce the error with a minimal example (I was actually putting all the event loop stuff and this does look to have hidden the problem), your sample will help me a lot (this is actually the first time I see someone packing all the code and resources ready for use!) and I hope to fix this soon (note that I'll be away for the next 6 days).

I'll post here when I have news about this issue.
Want to play movies in your SFML application? Check out sfeMovie!

fzn

  • Newbie
  • *
  • Posts: 16
    • View Profile
[MacOS X | SFML 1.5] Failed to create image.
« Reply #6 on: July 13, 2009, 01:11:21 am »
Fine, I hope you'll spot the issue without pain.
Don't hesitate to ask if you were to need anything related to the issue.

Happy downtime :)

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
[MacOS X | SFML 1.5] Failed to create image.
« Reply #7 on: July 21, 2009, 06:16:51 pm »
I've finally found out why it wasn't working.

With the changes made with SFML, I was forwarding OpenGL context activation (ie. make it the one to be used by the following OpenGL calls) through a "window" object, but the shared OpenGL context does not use any "window", so there was not usable OpenGL context (thus producing image loading failure) untill you were making a real window.
Want to play movies in your SFML application? Check out sfeMovie!

 

anything