• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Hanksha

SDL2 Texture

8 posts in this topic

Hi,

 

I've been trying to load large images (like 5000x2000, basically of map back ground) into an SDL_Texture*

 

Example:

SDL_Texture* image;

image = IMG_LoadTexture(renderer,"data/test.png");

But with a large resolution the image can't be load into the texture, with lower resolution like 1280x720 it works fine.

Is there a limit of size for an SDL_Texture?

0

Share this post


Link to post
Share on other sites

Well, since SDL_Texture is a small veneer over OpenGL textures, it is most likely not an SDL issue.

 

The first an most likely issue is you are running < OpenGl 2.0.  In this case, you need to have your texture dimensions be Power of Two in size.  Meaning your width or height should be 2,4,8,16,32,64,128,256,512, etc...

 

The second most common reason is you are exceeding YOUR graphic cards maximum texture size.  This is device specific, so it will depend on the machine you run on.  5000 is probably two wide, depending on your card.  Try scaling down to 4096 width and see what happens ( A common size limit ).

0

Share this post


Link to post
Share on other sites

(Sorry for late answer)

Yes apparently after few test, the limit looks to be 4096x4096.

Is there any documentation about that? (I didn't see anything on wiki of SDL2)

0

Share this post


Link to post
Share on other sites

(Sorry for late answer)

Yes apparently after few test, the limit looks to be 4096x4096.

Is there any documentation about that? (I didn't see anything on wiki of SDL2)

 

The documentation is from the OpenGL spec.  Unfortunately all you will see is "driver dependant".  Basically meaning its up to the company implementing the drivers.

 

You may be able to get documentation on this from the device manufacturer, but that wouldn't be fun.  There is however a GL call that allows you to query the maximum texture size, SDL may implement it, i am not sure.

1

Share this post


Link to post
Share on other sites

So if I put a large background 4096x4096, I might encounter a case of a computer who could not load it? (I've done 5 or 6 test on computers but most of them were not old)

0

Share this post


Link to post
Share on other sites

So if I put a large background 4096x4096, I might encounter a case of a computer who could not load it? (I've done 5 or 6 test on computers but most of them were not old)

 

 

Yes this is true; you need to establish a baseline machine.

 

4096x4096 is a reasonable MODERN minimum.  If you want to support as many machines as possible, 2048x2048 is a better call.

 

Intel Integrated graphics are about the baseline of 3D GPUs and as you can see from the documentation some of the HD3000 models have a hard limit of 2048:

 

Max 2d texture

2K x 2K

4K x 4K

4K x 4K

2K x 2K

4K x 4K

Max 3d texture

2048 x 2048 x 256

8092 x 8092 x 256

8092 x 8092 x 256

2048 x 2048 x 256

8092 x 8092 x 256

 

That said, the last 2k x 2k GPU was in 2007.  

 

The HD3000 is a good choice of baseline chips, as it is used in a TON of laptops and is also the base chip for most iMacs created in the past 6 or so years.

2

Share this post


Link to post
Share on other sites

Interesting! I'll follow your advice. I'll make a function to detect the GPU of the user so it could send a message error if it can't load texture because of that.

0

Share this post


Link to post
Share on other sites

Interesting! I'll follow your advice. I'll make a function to detect the GPU of the user so it could send a message error if it can't load texture because of that.

No need for that. SDL_GetRendererInfo will return a pointer to a SDL_RendererInfo object. You can check the max_texture_width and max_texture_height fields to see if your texture will fit.

1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0