SFML community forums
Help => General => Topic started by: Fuv on June 03, 2010, 07:45:01 pm
-
I was trying to add image as a background, but I noticed some images couldnt be loaded even I have the same code. Is it possible to load big image? I have code:
sf::Image Background;
if(!Background.LoadFromFile("back.jpg"))
return 1;
And its working for some images and for others not. Is the reason that they are too big(i mean too heavy - over 2MB for example)? If so how to load such a image?
Kind Regards
Fuv
-
You are restricted by the support of your graphics card. What are the dimensions of the image? The file size shouldn't matter, but the dimensions of the image will.
-
Ah, it could be.
My image is: 1842x1161.
Could You tell me what the limit is?
Kind Regards
Fuv
//edit:
Now I tried to load .png file. 57x105. And it also doesnt work. Why? What are possible problems?
-
Texture requirements come in powers of 2, so with that size, your graphics card will have to support 2048x2048. Unless you have a very old graphics card, you most likely can support that.
First off, make sure the file exists and that the casing is correct. Whatever program you used to save the file may have saved it in a nonstandard format. Unlikely, but it does happen. In which case, you can try saving it as a simple bitmap (*.bmp).
-
If you're loading lots of pixel data with your images it's possible to run out of vram too.
-
Thanks for advices. It was image fault - too many colors.
Kind Regards
Fuv
-
Thanks for advices. It was image fault - too many colors.
Kind Regards
Fuv
Oh? Interesting. I wouldn't think that would be a problem, unless maybe your buffer is 16-bit color but image 32-bit. But even then, it should downsample to 16-bit.