Advertisement

SDL Hardware Acceleration?

Started by February 23, 2005 02:38 PM
0 comments, last by evillive2 20 years ago
Hi! I'm working with SDL and moving along quite nicely... However, I don't know what it covers completely... Will it automatically perform hardware acceleration for my blitting, or do I have to use it in conjunction with openGL to get that? Is anything like that rolled in? And as an additional question... at what point should I be worried that my sprite system and blitting has issues? right now I can do somewhere around 500-1000 at 33fps on screen at a time ( animation only ) and see no real performance loss... if i go higher I will see a drop in FPS. Is this normal or is this way below the usual? Thanks!
Quote:

Will it automatically perform hardware acceleration for my blitting, or do I have to use it in conjunction with openGL to get that? Is anything like that rolled in?

I am not sure if this is video card dependent or not (if someone else can verify?) but in order to create surfaces in video memory you need to specify the SDL_HWSURFACE flag which from my experience is ignored while in windowed mode defaulting the new surfaces to system memory which are not accelerated. For hardware acceleration in anything else besides simple blitting you MUST use OpenGL. For simple games that don't use blending or rotation or scaling this isn't an issue and even some that use them sparingly it isn't but blending and rotation are pretty commonplace in most of todays games and OpenGL is the way to go.

Quote:

And as an additional question... at what point should I be worried that my sprite system and blitting has issues? right now I can do somewhere around 500-1000 at 33fps on screen at a time ( animation only ) and see no real performance loss... if i go higher I will see a drop in FPS. Is this normal or is this way below the usual?

Use a profiler. This is really the only way to see where the bottlenecks in your game are. I have noticed that most of my time is spent actually drawing to the screen. This is normal from what I have read. The only way to improve this is to decrease the amount of things you draw to the screen each frame like only redrawing what has changed since the last frame. One thing I have seen make a markable improvement is decreasing the actual number of times I call the blit function per frame.

This can be confusing but let me try to explain. Instead of redrawing my HUD every frame, I switched to creating an offscreen surface on which I draw the text, icons etc. and modify it only when they change. By making one call to blit the HUD surface to the screen each frame and a minimal amount of calls to modify it each frame (usually 0 80% of the time) before it gets blit to the screen, I saw a large improvement. This worked for me because my HUD doesn't change much over the course of each frame. If your HUD is changing completely or close to it every frame then this can actually hurt your performance. But anyway, the answer to your question is "it depends". With more information on what you are doing each frame etc we might be able to help but you will most likely have to try things out to find the best solution anyway.

Evillive2

This topic is closed to new replies.

Advertisement