SFML community forums

Help => Graphics => Topic started by: Me-Myself-And-I on November 03, 2022, 11:50:13 pm

Title: Is there a resolution limit in SFML?
Post by: Me-Myself-And-I on November 03, 2022, 11:50:13 pm
Is there a resolution limit and if so then what is it?So I loaded a 5760x1080 background into a texture for a scrolling background and I got this error.
"Failed to create texture, its internal size is too high (8192x2048, maximum is 2048x2048)"
Could someone please tell me what causes this error?
The window size is set to 1920x1080.
Title: Re: Is there a resolution limit in SFML?
Post by: kojack on November 04, 2022, 04:10:20 am
That error is given based on what OpenGL reports as the maximum supported by your system.
What GPU do you have? Older cards used to have a 2048x2048 limit. My RTX2080TI can do 32768x32768.
(I just loaded an 8192x4096 in SFML and rendered it correctly)
Title: Re: Is there a resolution limit in SFML?
Post by: Me-Myself-And-I on November 04, 2022, 09:10:12 pm
So the error is based on whatever is the limit of the system its run on?So do I just need to make something that scales it down?I thought it was the window resolution that was limited.Otherwise how would a scrolling background be possible if its larger than the window size?
Title: Re: Is there a resolution limit in SFML?
Post by: Hapax on November 07, 2022, 05:44:43 pm
It's the graphic card's texture size that has a limit. It's not linked to the size of the window; that's a separate thing. To have scrolling larger than the largest texture, you can simply draw two (or more) textures next to each other (i.e. break a big one into multiple small ones).
Thor has a solution to this. (https://bromeon.ch/libraries/thor/documentation/v2.1/classthor_1_1_big_texture.html)

Anyway, the first thing you could be doing is check the maximum size of the texture allowed by OpenGL on the system (as it could be any system, right?) and act appropriately. I think it's generally accepted that 2048x2048 is an acceptable minimum that you can take for granted.