Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Rendering modes for bitmaps?

This thread is locked; no one can reply to it. rss feed Print
Rendering modes for bitmaps?
Alianix
Member #10,518
December 2008
avatar

I couldn't find any info on this in the docs. What is the rendering mode for ALLEGRO_BITMAPs and is there a way to set it? By rendering mode I mean how does the 2D being drawn, quads?

Thanks.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Alianix
Member #10,518
December 2008
avatar

Forgive me perhaps I'm in a deep confusion but I understand that ALLEGRO_BITMAP is a rectangular region in Allegro 5. So is the underlying call to the renderer uses quad to draw it or something else? Is there any polygon trimming by default? If I understand correctly with al_draw_prim it's possible to draw a "bitmap" a rectangular region as a quad or other number of vertices. Is there any advantage in doing so?

Thanks Edgar

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Everything is ultimately drawn as triangles. This means bitmaps are rendered as two triangles that are coplanar. A quad doesn't have to be aligned with the screen or the z-axis either. But all the 2D drawing functions just map a quad yes.

If you only need 2D then there's no point using al_draw_prim unless you're drawing polygons, lines, or points.

Alianix
Member #10,518
December 2008
avatar

Thank you. Why do you think there is no point in polygon sprites for 2d? If you have a human character (sprite) for example there will be many empty spaces, so it should be faster with more then a few triangles?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Alianix
Member #10,518
December 2008
avatar

According to what I've read about polygon sprites is that they do perform better on the GPU, as lot of the empty spaces aren't drawn. However they may cost more CPU to process vertices. So there could be a significant speed improvement in drawing larger sprites with more triangles or the optimal number of triangles, this is why I was wondering if allegro 5 supports any such operations? I've no test of the speed improvement but Unity and also Cocos2d employs polygon sprites for performance.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Doctor Cop
Member #16,833
April 2018
avatar

So, if I draw a line using a for loop and al_draw_pixel(); will it be slower than using al_draw_line();?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: