Hello all,
I'm trying to port my old Allegro 4 code with AllegroGL to Allegro 5.
This concerns the drawing of a 'lit' sprite (the equivalent of draw_lit_sprite in allegro 4.2)
With AllegroGL I was doing this :
If I understand correctly the Allegro 5 documentation, managing alpha layer is done by using al_draw_tinted_xx_bitmap.
However I can't find how to lit(fog) a sprite.
One more question:
Is it faster to continue on using glLoadIdentity / glTranslatef / glScalef / glRotated or to switch to various Allegro 5 methods using _scaled_ / _rotated_ ?
Thank you in advance for your help.
al_draw_tinted_*() just sets the color of each vertex to the passed tint color. This works in conjunction with the currently set blender to get the final result.
You cannot achieve the lit sprite effect you are talking about using Allegro functions unless you use a shader.
Is it faster to continue on using glLoadIdentity / glTranslatef / glScalef / glRotated or to switch to various Allegro 5 methods using scaled / rotated ?
I can't say for certain (don't have time to look at Allegro's code), but just considering A5 has to apply the current transformation and then translate, scale, and rotate, your OpenGL code is probably a bit faster.
I think it's possible to draw lights using Allegro5 using a trick: draw one or more white or grayscale circle with an alpha 0.5 or so over the part you want to give a highlight. For fog, you could use a suitable half-transparent fog sprite in the same manner. But yes, for "real" fog you will need OpenGL or shaders.
Thank you for your feedback.
I also thought about drawing a filled rectangle with color and transparency. But I agree with you it won't work if the target sprite is not rectangular.