Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

wmjforest

sdl and allegro which one is faster

This topic is 5280 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi! how to calculte the cost of time :bliting a picture to screen ? below is two pieces of code , one is wrote with sdl , and the other with allegro. after running the code i got the result: the one with sdl is working with 20fps , and the allegro is working with 50fps same envionment , same picture , same 640x480x16 mode (linux 2.4.26 with rivafb driver) i wonder to know why , is allegro faster then sdl ? or my code is mistake ? //SDL source SDL_INIT(SDL_INIT_VIDEO); SDL_SetVideoMode(640,480,16,SDL_SWSURFACE); SDL_Surface *pbmp = IMG_Load(abc.bmp); // abc.bmp is a 640x480x16bit picture SDL_Surface * pScreen = SDL_GetVideoSurface(); cout<w,the_image->h); cout<

Share this post


Link to post
Share on other sites
Advertisement
Hmm, your code looks corrupt. Try the source tags; look under the faq.

EDIT: Perhaps OT, but I think you shuld consider update your kernel for better performance.

[edited by - danne89 on June 2, 2004 4:18:29 PM]

Share this post


Link to post
Share on other sites
Allegro and SDL both have several different techniques for driving the screen on different platforms, so performance on each under a given set of circumstances will be dependent on which underlying method they''re each using.

Additionally, because they use different methods on different platforms, it could even vary depending on the video driver (or some other software component) even on the same platform.

I suspect that the general answer is very much "It depends".

I don''t know a great deal about SDL''s underlying methods, but Allegro has several different "Drivers" it uses itself, for example, (under Linux), X, DGA2, DGA2 soft (under Windows), DirectX, DirectX soft, GDI.

Each Allegro driver will have its own performance characteristic.

Also, make sure you are not using any library which needs to do colour depth conversion, that is *extremely* expensive under any situation.

If you''re running in a Window, it will need to use the same colour depth as the rest of the system, fullscreen sometimes too. Allegro converts colour depths to match, which is a performance killer.

Mark

Share this post


Link to post
Share on other sites
SDL''s 2D blitting is known to currently be a bit on the slow side; it doesn''t help that you''re using the SDL_SWSURFACE flag, which forces it to do all rendering in software. Try this instead:

SDL_SetVideoMode(640,480,16,SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_FULLSCREEN|SDL_ANYFORMAT);

That should be considerably faster.

Also, an OpenGL backend for SDL''s 2D operations is currently under development; it''s not in the official release yet, but you can check out a beta OpenGL wrapper here: http://olofson.net/mixed.html
Using that boosts the framerate of a small simulation I wrote from about 40 fps to over 460 fps.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!