SFML community forums

Help => Graphics => Topic started by: hexvector on July 19, 2010, 11:28:28 pm

Title: Maximum size of sf::Image and sf::Sprite
Post by: hexvector on July 19, 2010, 11:28:28 pm
If I have the following code:

Code: [Select]
   sf::Image bgImage;
    if (!bgImage.LoadFromFile("background.jpg")) {
        return EXIT_FAILURE;
    }
    sf::Sprite Background(bgImage);

   [... more code ...]
   App.Draw(Background);


What is the maximum image size (or is it limited by file/memory size?)
for sf::Image and sf::Sprite?

I know 1900x1200 works but 8000x5000 does not work (app closes).

Thanks.
Title: Maximum size of sf::Image and sf::Sprite
Post by: Laurent on July 19, 2010, 11:31:47 pm
The limit is set by the graphics driver, and depends of course on what graphics card is behind.

Old cards may be limited to 512x512, and the most recent ones can probably reach 8192x8192. Yours is most likely limited to 2048x2048 or 4096x4096.
Title: Maximum size of sf::Image and sf::Sprite
Post by: Antidote on July 25, 2010, 12:55:47 am
Isn't there a way to query the drivers and get the max texture size that way?
Title: Maximum size of sf::Image and sf::Sprite
Post by: Laurent on July 25, 2010, 10:21:28 am
SFML 2 has a function for that.

The corresponding OpenGL call is the following:
Code: [Select]
GLint size;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size);