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

Author Topic: sf::Image is too big?  (Read 2849 times)

0 Members and 1 Guest are viewing this topic.

Fuv

  • Newbie
  • *
  • Posts: 35
    • View Profile
sf::Image is too big?
« 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:

Code: [Select]
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

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
sf::Image is too big?
« Reply #1 on: June 03, 2010, 08:21:41 pm »
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.

Fuv

  • Newbie
  • *
  • Posts: 35
    • View Profile
sf::Image is too big?
« Reply #2 on: June 03, 2010, 09:29:47 pm »
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?

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
sf::Image is too big?
« Reply #3 on: June 03, 2010, 11:28:15 pm »
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).

Ashenwraith

  • Sr. Member
  • ****
  • Posts: 270
    • View Profile
sf::Image is too big?
« Reply #4 on: June 04, 2010, 07:24:02 am »
If you're loading lots of pixel data with your images it's possible to run out of vram too.

Fuv

  • Newbie
  • *
  • Posts: 35
    • View Profile
sf::Image is too big?
« Reply #5 on: June 04, 2010, 12:50:46 pm »
Thanks for advices. It was image fault - too many colors.

Kind Regards
Fuv

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
sf::Image is too big?
« Reply #6 on: June 04, 2010, 07:19:05 pm »
Quote from: "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.