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

Author Topic: Size max of an sf::Image  (Read 3125 times)

0 Members and 2 Guests are viewing this topic.

Janacek

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Size max of an sf::Image
« on: October 02, 2013, 11:29:46 am »
Hi,

I'm using the sf::Image to create an image of a map I've generated, the problem is that the map can be very huge (like 2000000px * 2000000px). But the size max of an sf::Image on my pc is 8192 * 8192.

I've decided to cut the map into different chunks so I can create Image of a smaller size.

But my pc has a "recent" graphic card, so I can do Images of 8192*8192, my question is, can I base the size of the chunk with the resolution of the user ?

For example, my resolution is 1920*1080, so I'll cut my chunks with this size, if a user has a resolution of 800*600, can I conclude I can do sf::Image of size 800*600 without having issues ?

Thanks !

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Size max of an sf::Image
« Reply #1 on: October 02, 2013, 11:34:45 am »
Since maximum texture sizes are square, I think it's safe to say that's not how it works.

But if you're going to cut things into chunks anyway, the simple and safe solution is to use 512*512 chunks, since that's the smallest max texture size you can find these days.

Janacek

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Size max of an sf::Image
« Reply #2 on: October 02, 2013, 11:50:16 am »
I see, thanks :)

I think I'll cut the map into chunks of 515*515.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Size max of an sf::Image
« Reply #3 on: October 02, 2013, 11:54:09 am »
Unless you're using SFML 1, sf::Image has no maximum size (except the memory limit), only sf::Texture has.

And no, the maximum texture size is not tied to the desktop resolution, it is a fixed OpenGL property of the GPU. But you can retrieve this value and base your code on it, with sf::Texture::getMaximumSize().
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Size max of an sf::Image
« Reply #4 on: October 02, 2013, 11:56:18 am »
But the size max of an sf::Image on my pc is 8192 * 8192.
You mean the size of sf::Texture in video memory. sf::Image is only a container, its size is limited by available RAM.

For automated splitting into chunks, you could have a look at thor::BigTexture. Note that not all of the original functionality is provided.

But are you sure a huge texture is a good representation? Do you need the whole image at once, or could you simply draw the tiles/parts of the map subsequently?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Janacek

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Size max of an sf::Image
« Reply #5 on: October 02, 2013, 12:46:24 pm »
Ha my bad, yes I was using a RenderTexture, I named the variable _img so I got confused.

I'll look at thor::BigTexture, looks promising :)

I'll test the BigTexture and dividing the map into different chunks, I'll write a feedback here after :)

BaneTrapper

  • Full Member
  • ***
  • Posts: 213
  • Do you even see this, i dont need it.
    • View Profile
    • Email
Re: Size max of an sf::Image
« Reply #6 on: October 02, 2013, 02:53:56 pm »
(like 2000000px * 2000000px).
Loading texture that big...
Stream it during runtime, it will take more process but its the only way for that size.
If streaming is out of grasp, split map its many little peaces and load/release as needed.
BaneTrapperDev@hotmail.com Programing, Coding
Projects: Not in development(unfinished/playable):
http://en.sfml-dev.org/forums/index.php?topic=11073.msg76266#msg76266
UP and in Development: The Wanderer - Lost in time
http://en.sfml-dev.org/forums/index.php?topic=14563.0

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Size max of an sf::Image
« Reply #7 on: October 02, 2013, 03:39:24 pm »
Just clear things up: 2000000px * 2000000px = 14 terabytes of RAM. This is of course impossible to load entirely at once, splitted or not splitted.

Either this is the actual size and this is crazy, or this is not and in this case it would be great to talk with the actual expected size instead of such huge numbers ;)
Laurent Gomila - SFML developer