I'm still working on my little C++ game framework upon Allegro 5 and today, I've added the capability to rotate your Sprites. A Sprite is represented by a region of a Bitmap.

Actually, what I do when I render a Sprite :

Note: b is the instance of Bitmap used for this sprite, which returns its ALLEGRO_BITMAP* by a call to the method bitmap(). This Bitmap is actually a 512x512 bitmap with every sprites in it. This bitmap is a video-memory bitmap.

As you can see, I create a sub-bitmap of the big one in order to rotate only the part that I need to draw rotated.Do you think that by doing that, I'm doing an hardware-accelerated rotation ? Have you got any advice about this ?It's my first use of sub-bitmaps and I'm not really sure to use them correctly.

Thanks!r'm

PS: for those who remember my last post, I'm now able to render 18000 animated sprites at 50FPS! (10000 rotated&animated sprites at 50fps)

Actually, by using al_draw_scaled_bitmap when I don't need to rotate or tint, it allows me to directly draw a part of a bitmap without creating a sub-bitmap, which seems faster if my test were ok.Thank you for your answer!

Do you think that by doing that, I'm doing an hardware-accelerated rotation ?

Yes

Quote:

Have you got any advice about this ?

Two things:1. the unstable branch of A5 has al_draw_scaled_rotated_bitmap_region.2. You could use transformations to avoid creating the temporary bitmap, if you think it's a bottleneck (it probably isn't).