![]() |
|
Increasing the speed of transitioning from one image into another? |
BrknPhoenix
Member #7,304
June 2006
|
What I'm doing right now is fading one menu screen into another when a menu item is selected. Problem is, it's really slow. The images are 800x600. I know it's the images that are the problem because when I do fade in/out from/to black, the speed is just fine. It's only when the image has something in it that the slowdown occurs. Here's the function I'm using:
Any tips to speed things up? |
Simon Parzer
Member #3,330
March 2003
![]() |
Your problem is obviously draw_trans_sprite. It's an Allegro function and therefore uses software rendering. That means that it has to check every pixel of your image and manually blend it with the correspondending pixel from the new image (800x600 => 480000 pixels). |
HoHo
Member #4,534
April 2004
![]() |
First and probably the simpliest speedup is to create startImage and endImage once, not in every frame. Also a lot of speed can be gained if you don't use video bitmaps with blending. That means you first do all the drawin in memory bitmaps and blit the result to screen. If you need ~30-250% faster blending you might want to try compiling Allegro using plain-c functions. I've seen that draw_trans_sprite can be much faster in c-mode: Another thing that can speed things up is to use draw_trans_rle_sprite() but that only works good for read-only images. In Linux you can compile Allegro in C mode with ./configure --enable-asm=no. I don't know how you can do it in windows. __________ |
deps
Member #3,858
September 2003
![]() |
A J
Member #3,025
December 2002
![]() |
or do as i did, and write a blender in SSE2, works awesomely fast! ___________________________ |
|