SDL - Too slow

Started by
36 comments, last by 23yrold3yrold 19 years, 1 month ago
Hi guys, I've a problem I working with the SDL under linux and under windows too, and the HWSURFACE are not supported (I've a ATI Radeon Mobility 9000 IGP). So the fps is very slow (24 fps). I've 3 surfaces. Screen -> 640x480x32 Tiles -> 320x128x24 VirtualScreen -> 1280x1024x24 (where I draw my world) All the surface are passed through the SDL_DisplayFormat(tiles); I use SDL_Flip to draw the scene... Where I wrong? Is better use another libraries?
Advertisement
Try it without SDL_DisplayFormat. What are you doing that makes it slow?
Rob Loach [Website] [Projects] [Contact]
Make sure everything is display formatted into 32bpp. Make sure your FPS counter works right.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
Quote:Original post by NighTiger
Screen -> 640x480x32
Tiles -> 320x128x24
VirtualScreen -> 1280x1024x24 (where I draw my world)


Wait, are you drawing the entire 1280 x 1024 surface or just a portion of it everytime? So my question is how are you blitting that surface to the screen?
Without the SDL_DisplayFormat is worse than with

The problem is not only with the surface of 1280x1024x24... because just with one surface of 640x480 I have the same problem

tnx
Are you passing everything through SDL_DisplayFormat for *every* frame? That's gonna be *sllooooooowww*. Always make sure that all your surfaces have the exact same format (the format of the video surface). If needed, convert them *once*, in the init part of your program.
Something bothers me about this whole SDL_DisplayFormat(tiles) thing. Do you mean that you are passing the tile (320x128x24) surfaces through SDL_DisplayFormat before drawing them to VirtualScreen, and the drawing VirtualScreen with SDL_DisplayFormat on every frame? That'd be real bad. First of all because you'd be converting the tile surfaces 3 times (1 - convert from 24bit to 32bit using SDL_DisplayFormat, 2 - convert from 32bit to 24bit when blitting to VirtualScreen, 3 - convert from 24bit to 32bit using SDL_DisplayFormat). Second of all you only need to convert the surfaces once. Just convert the VirtualScreen and tiles with SDL_DisplayFormat, keep the new surfaces and SDL_FreeSurface the old ones. Then simply blit tiles to VirtualScreen and VirtualScreen to the real screen without any conversion. If you're already doing this, then never mind.
Quote:Original post by Anonymous Poster
If you're already doing this, then never mind.


okkey... never mind because I just doing this :°°°°(
What do you need the virtual screen for anyway?
Quote:Original post by Kylotan
What do you need the virtual screen for anyway?


I use my VS for make a map with tiles

This topic is closed to new replies.

Advertisement