I'm trying to port some code from processing, and I've found problems with the PushMatrix and PopMatrix. Example:
pushMatrix();
translate(x,y);
rotate(alfa);
translate(desx,desy);
image(bitmap,0,0);
pushMatrix();
translate(x,y);
popMatrix();
popMatrix();
Transformations in allegro are built as:
ALLEGRO_TRANSFORM t;
al_copy_transform(&old,&t);
al_intentity_transform(&t)
al_translate_transform(x,y);
al_rotate_transform(alfa);
al_use_transform(&t)
al_draw_bitmap(bitmap,0,0);
al_identity_transform(&old);
al_use_transform(&old);
It works perfectly with one bitmap, but I haven't foud a way to concatenate two transforms the same way as with pushMatrix, and I think I don't fully understand the behavior of allegro transformations.
Any tip or help will be wellcome.
Thanks!
In AllegroFlare's placement2d, you get these two functions:
previous_transform is an ALLEGRO_TRANSFORM, member of placement2d
Thank you very much.
I missed the function al_compose_transform, which is the key to combine the matrix stack.
I should read more carefully the man pages.
Again, thank you for your time.