<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>al_draw_prim filled in with color</title>
		<link>http://www.allegro.cc/forums/view/614089</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 28 Mar 2014 13:24:39 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;d like to draw a custom polygon and fill it in. I&#39;m using al_draw_prim like so:</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">for</span><span class="k2">(</span><span class="k1">int</span> i <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> i <span class="k3">&lt;</span> <span class="n">4</span><span class="k2">;</span> i<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span> <span class="k2">{</span>
    <span class="c">//some stuff to define realX and realY - it makes a square</span>
    backgroundColor_ <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_map_rgb"><span class="a">al_map_rgb</span></a><span class="k2">(</span><span class="n">255</span>,<span class="n">0</span>,<span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
    v<span class="k2">[</span>i<span class="k2">]</span> <span class="k3">=</span> <span class="k2">{</span> .x <span class="k3">=</span> realX, .y <span class="k3">=</span> realY, .z <span class="k3">=</span> <span class="n">0</span>, .color <span class="k3">=</span> backgroundColor_ <span class="k2">}</span><span class="k2">;</span>
<span class="k2">}</span>
<a href="http://www.allegro.cc/manual/al_draw_prim"><span class="a">al_draw_prim</span></a><span class="k2">(</span>v, NULL, NULL, <span class="n">0</span>, <span class="n">4</span>, ALLEGRO_PRIM_LINE_LOOP<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

This draws an outline of a square, but I&#39;d like it colored in. Any thoughts?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Artelis)</author>
		<pubDate>Wed, 26 Mar 2014 09:09:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="http://www.liballeg.org/a5docs/refman/primitives.html#al_draw_filled_polygon">http://www.liballeg.org/a5docs/refman/primitives.html#al_draw_filled_polygon</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Wed, 26 Mar 2014 11:22:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Since: 5.1.0</p><p>Thanks, but I&#39;m on the latest stable build (5.0.10)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Artelis)</author>
		<pubDate>Wed, 26 Mar 2014 11:48:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If all you need is a square, 5.0 has <a href="https://www.allegro.cc/manual/5/al_draw_filled_rectangle">al_draw_filled_rectangle()</a>.  Other shapes could be drawn with al_draw_filled_triangle(), albeit with more complexity.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Wed, 26 Mar 2014 11:59:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>No, I&#39;m drawing all sorts of polygons. I suppose I COULD do triangles, but that would be a lot of annoying.</p><p>Can I do something like load a 1x1px bitmap of the desired color and stretch it over the whole prim?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Artelis)</author>
		<pubDate>Wed, 26 Mar 2014 12:03:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The ex_prim.c in the examples shows textured polygons of arbitrary shape, so I&#39;d say yes.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Wed, 26 Mar 2014 12:13:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, we&#39;ll see what happens. Thanks.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Artelis)</author>
		<pubDate>Wed, 26 Mar 2014 12:20:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If you want to draw square, draw it as two triangles:
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_draw_prim"><span class="a">al_draw_prim</span></a><span class="k2">(</span><span class="k2">[</span>your array with six vertices, from <span class="n">0</span> to <span class="n">5</span><span class="k2">]</span>, <span class="n">0</span>, NULL, <span class="n">0</span>, <span class="n">6</span>, ALLEGRO_PRIM_TRIANGLE_LIST<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Aikei_c)</author>
		<pubDate>Wed, 26 Mar 2014 12:57:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614089/998418#target">Artelis</a> said:</div><div class="quote"><p>No, I&#39;m drawing all sorts of polygons.</p></div></div><p>
In that case, be very careful if you continue to use al_draw_prim() at any step of the way. It&#39;s very expensive in terms of CPU overhead to call and calling it more than just a few times per frame of your gameplay could kill your framerate. On the flip side, you can prep everything you intend to draw into one massive array and just draw that with a single al_draw_prim() call.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kris Asick)</author>
		<pubDate>Wed, 26 Mar 2014 14:24:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Aikei_c: My shapes are much more complicated than that.</p><p>Kris: Thanks for the insight. I&#39;ll look out for that. Why is it so CPU intensive?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Artelis)</author>
		<pubDate>Thu, 27 Mar 2014 00:59:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614089/998437#target">Kris Asick</a> said:</div><div class="quote"><p>
In that case, be very careful if you continue to use al_draw_prim() at any step of the way. It&#39;s very expensive in terms of CPU overhead to call and calling it more than just a few times per frame of your gameplay could kill your framerate. On the flip side, you can prep everything you intend to draw into one massive array and just draw that with a single al_draw_prim() call. 
</p></div></div><p>
You say this all the time, but I&#39;ve never seen any profiling to back it up.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 27 Mar 2014 04:20:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614089/998489#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>You say this all the time, but I&#39;ve never seen any profiling to back it up.</p></div></div><p>
You&#39;re welcome to write some up and test it yourself, but the situation I ran into was basically this:</p><p>Drawing 5,000 sprites/sec with al_draw_bitmap() &gt; 60 FPS</p><p>Drawing 5,000 quads/sec with a single al_draw_prim() call &gt; 60 FPS</p><p>Drawing 5,000 quads/sec with 5,000 al_draw_prim() calls &lt; 1 FPS</p><p>In fact, it doesn&#39;t take that many calls to kill the framerate. Don&#39;t take my word for it and try it for yourself.</p><p>Now, I should point out, the last time I tested this was with Allegro 5.0.8, so maybe things have changed since then, but considering the way al_draw_prim() works in general, sending everything to draw in a single call is just better for performance regardless of anything. :B
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kris Asick)</author>
		<pubDate>Thu, 27 Mar 2014 13:31:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I remember doing some tests as well, and the setup overhead of the al_draw_prim code is rather high, and most of it is spent in the opengl driver itself validating GL state. It&#39;s a known GL problem, one which we can try and mitigate by reducing the amount of state that the primitives addon touches, but it&#39;ll probably still be a problem.</p><p>The current way to reduce overhead in GL is to change as little state, and do as few individual draw calls as possible. Usually that&#39;s done by batching as much data into a single buffer object as you can and dispatching some gl*Array/gl*List calls.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Thu, 27 Mar 2014 16:33:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="p">#include &lt;allegro5/allegro5.h&gt;</span>
<span class="number">  2</span><span class="p">#include &lt;allegro5/allegro_image.h&gt;</span>
<span class="number">  3</span><span class="p">#include &lt;allegro5/allegro_primitives.h&gt;</span>
<span class="number">  4</span><span class="p">#include "stdio.h"</span>
<span class="number">  5</span>
<span class="number">  6</span><span class="k1">int</span> main<span class="k2">(</span><span class="k1">int</span> argc, <span class="k1">char</span><span class="k3">*</span><span class="k3">*</span> argv<span class="k2">)</span>
<span class="number">  7</span><span class="k2">{</span>
<span class="number">  8</span>  <span class="k1">int</span> N <span class="k3">=</span> <span class="n">10</span><span class="k2">;</span>
<span class="number">  9</span>  <span class="k1">if</span><span class="k2">(</span>argc <span class="k3">&gt;</span> <span class="n">1</span><span class="k2">)</span>
<span class="number"> 10</span>  <span class="k2">{</span>
<span class="number"> 11</span>    N <span class="k3">=</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_54.html" target="_blank">atoi</a><span class="k2">(</span>argv<span class="k2">[</span><span class="n">1</span><span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 12</span>  <span class="k2">}</span>
<span class="number"> 13</span>  <span class="k1">else</span>
<span class="number"> 14</span>  <span class="k2">{</span>
<span class="number"> 15</span>    <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"Usage: bench 100000\n"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 16</span>    <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 17</span>  <span class="k2">}</span>
<span class="number"> 18</span>  
<span class="number"> 19</span>  
<span class="number"> 20</span>  <a href="http://www.allegro.cc/manual/al_init"><span class="a">al_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 21</span>  <a href="http://www.allegro.cc/manual/al_init_image_addon"><span class="a">al_init_image_addon</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 22</span>  <a href="http://www.allegro.cc/manual/al_init_primitives_addon"><span class="a">al_init_primitives_addon</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 23</span>  
<span class="number"> 24</span>  <a href="http://www.allegro.cc/manual/ALLEGRO_DISPLAY"><span class="a">ALLEGRO_DISPLAY</span></a><span class="k3">*</span> disp <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_display"><span class="a">al_create_display</span></a><span class="k2">(</span><span class="n">800</span>, <span class="n">600</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 25</span>  
<span class="number"> 26</span>  <a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a><span class="k3">*</span> bmp <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_load_bitmap"><span class="a">al_load_bitmap</span></a><span class="k2">(</span><span class="s">"cow2.png"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 27</span>  <a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a><span class="k3">*</span> buffer <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_bitmap"><span class="a">al_create_bitmap</span></a><span class="k2">(</span><span class="n">400</span>, <span class="n">400</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 28</span>  <a href="http://www.allegro.cc/manual/al_set_target_bitmap"><span class="a">al_set_target_bitmap</span></a><span class="k2">(</span>buffer<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 29</span>  
<span class="number"> 30</span>  <span class="k1">int</span> w <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_bitmap_width"><span class="a">al_get_bitmap_width</span></a><span class="k2">(</span>bmp<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 31</span>  <span class="k1">int</span> h <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_bitmap_height"><span class="a">al_get_bitmap_height</span></a><span class="k2">(</span>bmp<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 32</span>  
<span class="number"> 33</span>  <a href="http://www.allegro.cc/manual/ALLEGRO_COLOR"><span class="a">ALLEGRO_COLOR</span></a> col <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_map_rgb_f"><span class="a">al_map_rgb_f</span></a><span class="k2">(</span><span class="n">1</span>,<span class="n">1</span>,<span class="n">1</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 34</span>  <a href="http://www.allegro.cc/manual/ALLEGRO_VERTEX"><span class="a">ALLEGRO_VERTEX</span></a> vtx<span class="k2">[</span><span class="n">4</span><span class="k2">]</span><span class="k2">;</span>
<span class="number"> 35</span>  
<span class="number"> 36</span>  <span class="k1">double</span> t1 <span class="k3">=</span> al_current_time<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 37</span>  <span class="k1">for</span><span class="k2">(</span><span class="k1">int</span> ii <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> ii <span class="k3">&lt;</span> N<span class="k2">;</span> ii<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span>
<span class="number"> 38</span>  <span class="k2">{</span>
<span class="number"> 39</span>    vtx<span class="k2">[</span><span class="n">0</span><span class="k2">]</span>.x <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 40</span>    vtx<span class="k2">[</span><span class="n">0</span><span class="k2">]</span>.y <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 41</span>    vtx<span class="k2">[</span><span class="n">0</span><span class="k2">]</span>.u <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 42</span>    vtx<span class="k2">[</span><span class="n">0</span><span class="k2">]</span>.v <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 43</span>    vtx<span class="k2">[</span><span class="n">0</span><span class="k2">]</span>.color <span class="k3">=</span> col<span class="k2">;</span>
<span class="number"> 44</span>    
<span class="number"> 45</span>    vtx<span class="k2">[</span><span class="n">1</span><span class="k2">]</span>.x <span class="k3">=</span> w<span class="k2">;</span>
<span class="number"> 46</span>    vtx<span class="k2">[</span><span class="n">1</span><span class="k2">]</span>.y <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 47</span>    vtx<span class="k2">[</span><span class="n">1</span><span class="k2">]</span>.u <span class="k3">=</span> w<span class="k2">;</span>
<span class="number"> 48</span>    vtx<span class="k2">[</span><span class="n">1</span><span class="k2">]</span>.v <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 49</span>    vtx<span class="k2">[</span><span class="n">1</span><span class="k2">]</span>.color <span class="k3">=</span> col<span class="k2">;</span>
<span class="number"> 50</span>    
<span class="number"> 51</span>    vtx<span class="k2">[</span><span class="n">2</span><span class="k2">]</span>.x <span class="k3">=</span> w<span class="k2">;</span>
<span class="number"> 52</span>    vtx<span class="k2">[</span><span class="n">2</span><span class="k2">]</span>.y <span class="k3">=</span> h<span class="k2">;</span>
<span class="number"> 53</span>    vtx<span class="k2">[</span><span class="n">2</span><span class="k2">]</span>.u <span class="k3">=</span> w<span class="k2">;</span>
<span class="number"> 54</span>    vtx<span class="k2">[</span><span class="n">2</span><span class="k2">]</span>.v <span class="k3">=</span> h<span class="k2">;</span>
<span class="number"> 55</span>    vtx<span class="k2">[</span><span class="n">2</span><span class="k2">]</span>.color <span class="k3">=</span> col<span class="k2">;</span>
<span class="number"> 56</span>    
<span class="number"> 57</span>    vtx<span class="k2">[</span><span class="n">3</span><span class="k2">]</span>.x <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 58</span>    vtx<span class="k2">[</span><span class="n">3</span><span class="k2">]</span>.y <span class="k3">=</span> w<span class="k2">;</span>
<span class="number"> 59</span>    vtx<span class="k2">[</span><span class="n">3</span><span class="k2">]</span>.u <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 60</span>    vtx<span class="k2">[</span><span class="n">3</span><span class="k2">]</span>.v <span class="k3">=</span> h<span class="k2">;</span>
<span class="number"> 61</span>    vtx<span class="k2">[</span><span class="n">3</span><span class="k2">]</span>.color <span class="k3">=</span> col<span class="k2">;</span>
<span class="number"> 62</span>  
<span class="number"> 63</span>    <a href="http://www.allegro.cc/manual/al_draw_prim"><span class="a">al_draw_prim</span></a><span class="k2">(</span>vtx, <span class="n">0</span>, bmp, <span class="n">0</span>, <span class="n">4</span>, ALLEGRO_PRIM_TRIANGLE_FAN<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 64</span>  <span class="k2">}</span>
<span class="number"> 65</span>  <span class="k1">double</span> delta1 <span class="k3">=</span> al_current_time<span class="k2">(</span><span class="k2">)</span> <span class="k3">-</span> t1<span class="k2">;</span>
<span class="number"> 66</span>  
<span class="number"> 67</span>  <span class="k1">double</span> t2 <span class="k3">=</span> al_current_time<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 68</span>  <span class="k1">for</span><span class="k2">(</span><span class="k1">int</span> ii <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> ii <span class="k3">&lt;</span> N<span class="k2">;</span> ii<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span>
<span class="number"> 69</span>  <span class="k2">{</span>
<span class="number"> 70</span>    <a href="http://www.allegro.cc/manual/al_draw_bitmap"><span class="a">al_draw_bitmap</span></a><span class="k2">(</span>bmp, <span class="n">0</span>, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 71</span>  <span class="k2">}</span>
<span class="number"> 72</span>  <span class="k1">double</span> delta2 <span class="k3">=</span> al_current_time<span class="k2">(</span><span class="k2">)</span> <span class="k3">-</span> t2<span class="k2">;</span>
<span class="number"> 73</span>  
<span class="number"> 74</span>  <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"Primitives: %f\nAllegro: %f\nRatio:%f\n"</span>, delta1, delta2, delta1 <span class="k3">/</span> delta2<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 75</span>  
<span class="number"> 76</span>  <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 77</span><span class="k2">}</span>
</div></div><p>

</p><pre class="terminal scroll">:PrimBench ./bench 100000
Primitives: 0.172736
Allegro: 0.151638
Ratio:1.139134
:PrimBench ./bench 100000
Primitives: 0.182917
Allegro: 0.158097
Ratio:1.156992
:PrimBench ./bench 1000000
Primitives: 1.439983
Allegro: 1.421288
Ratio:1.013154
:PrimBench ./bench 10000000
Primitives: 13.877668
Allegro: 14.003940
Ratio:0.990983</pre><p>

There is no appreciable difference in performance.</p><p>Also: <a href="https://www.allegro.cc/forums/thread/613609/993692#target">https://www.allegro.cc/forums/thread/613609/993692#target</a> but I don&#39;t feel like repeating that test.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Thu, 27 Mar 2014 16:49:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I have to admit that its been a long time since I last did my test, the primitive performance may have improved.. but I was drawing a lot of circles. It was kinda slow <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" /></p><p>But here&#39;s a couple tests on my laptop:</p><p>Original code:
</p><div class="source-code snippet"><div class="inner"><pre>moose@balsa:~<span class="k3">/</span>projects$ .<span class="k3">/</span>prim-test <span class="n">100000</span>
Primitives: <span class="n">0</span>.<span class="n">480269</span>
Allegro: <span class="n">0</span>.<span class="n">550363</span>
Ratio:0.872640
moose@balsa:~<span class="k3">/</span>projects$ .<span class="k3">/</span>prim-test <span class="n">1000000</span>
Primitives: <span class="n">4</span>.<span class="n">643804</span>
Allegro: <span class="n">7</span>.<span class="n">965119</span>
Ratio:0.583018
</pre></div></div><p>

Heald drawing:
</p><div class="source-code snippet"><div class="inner"><pre>moose@balsa:~<span class="k3">/</span>projects$ .<span class="k3">/</span>prim-test <span class="n">100000</span>
Primitives: <span class="n">0</span>.<span class="n">480745</span>
Allegro: <span class="n">0</span>.<span class="n">028070</span>
Ratio:17.126648
moose@balsa:~<span class="k3">/</span>projects$ .<span class="k3">/</span>prim-test <span class="n">1000000</span>
Primitives: <span class="n">4</span>.<span class="n">584236</span>
Allegro: <span class="n">0</span>.<span class="n">255358</span>
Ratio:17.952193
</pre></div></div><p>

Not exactly no appreciable difference. I&#39;d try it on my nvidia gpu, but the nvidia drivers are currently broken on linux with this gpu.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Thu, 27 Mar 2014 17:15:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614089/998543#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p> Heald drawing: 
</p></div></div><p>Do you <i>seriously</i> not see the problem with that comparison? Really?</p><p>But thanks for showing that <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_prim"><span class="a">al_draw_prim</span></a></span> is 2x as fast as <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_bitmap"><span class="a">al_draw_bitmap</span></a></span> <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Thu, 27 Mar 2014 17:18:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614089/998546#target">SiegeLord</a> said:</div><div class="quote"><p>Do you seriously not see the problem with that comparison? Really?</p></div></div><p>No, but then I didn&#39;t look all that closely at the code. I assumed the higher the number the slower it was. And with held drawing, the primitives number is clearly bigger.</p><p>I&#39;m guessing you&#39;re complaining that with held drawing it isn&#39;t an &quot;apples to apples&quot; comparison. It doesn&#39;t need to be though. Setting up al_draw_prim to batch all of the calls would be rather annoying <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Thu, 27 Mar 2014 17:26:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614089/998548#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p> It doesn&#39;t need to be though.
</p></div></div><p>Yes it does, if you want to make a claim about <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_prim"><span class="a">al_draw_prim</span></a></span> being slow.</p><p>It is not slow, and is the fastest method of drawing polygons available in Allegro.</p><p>EDIT: Well, aside from <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_indexed_prim"><span class="a">al_draw_indexed_prim</span></a></span>, <span class="source-code">al_draw_vertex_buffer</span> and <span class="source-code">al_draw_indexed_buffer</span> which are all faster, but a little bit harder to use.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Thu, 27 Mar 2014 17:31:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m not trying to put you down or anything. You seem to be touchy on this subject. When people try using the primitives functions, they do a small test and draw X number of shapes. Then they see that they can only draw say a few thousand and go &quot;wtf?&quot;. That is the &quot;slow&quot; we&#39;re talking about.</p><p>And just because something is &quot;the fastest available&quot; doesn&#39;t mean it isn&#39;t slow <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /></p><p>And, as I mentioned earlier, it isn&#39;t allegro&#39;s or the primitive addon&#39;s fault. It&#39;s a GL thing.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Thu, 27 Mar 2014 17:37:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614089/998551#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p> That is the &quot;slow&quot; we&#39;re talking about.
</p></div></div><p>Oh really? How about this?</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614089/998530#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p> setup overhead of the al_draw_prim code is rather high
</p></div></div><p>It&#39;s lower than <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_bitmap"><span class="a">al_draw_bitmap</span></a></span> &#39;s. Why single out <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_prim"><span class="a">al_draw_prim</span></a></span>?</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614089/998551#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p> Then they see that they can only draw say a few thousand and go &quot;wtf?&quot;.
</p></div></div><p>They go like that to <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_bitmap"><span class="a">al_draw_bitmap</span></a></span> just as much if not more, and we don&#39;t say <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_bitmap"><span class="a">al_draw_bitmap</span></a></span> is slow. We say, use a helper function explicitly designed to minimize the overhead. We say, it&#39;s not how it is supposed to be used.</p><p>There is absolutely no problem (that anybody has shown) with <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_prim"><span class="a">al_draw_prim</span></a></span> and its brethren. If there are optimizations to be made, they are to be made in the code using it, whether it be user code or library code.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Thu, 27 Mar 2014 17:55:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614089/998555#target">SiegeLord</a> said:</div><div class="quote"><p>It&#39;s lower than al_draw_bitmap &#39;s. Why single out al_draw_prim?</p></div></div><p>A bunch of individual bitmap draws is pretty darn inefficient too. We do say it is slow <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /> it&#39;s said over and over again, if you do call it a lot, make sure to use an atlas and held drawing, or even batch stuff up in buffer objects to use gl*Array&#39;s.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>There is absolutely no problem (that anybody has shown) with al_draw_prim and its brethren.</p></div></div><p>I still think you&#39;re taking this personally. It is not a slight against you, or allegro. It&#39;s just how this kind of usage is. Lots of individual drawing calls is slow. period.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Thu, 27 Mar 2014 18:18:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614089/998514#target">Kris Asick</a> said:</div><div class="quote"><p>
Drawing 5,000 quads/sec with 5,000 al_draw_prim() calls &lt; 1 FPS</p><p>In fact, it doesn&#39;t take that many calls to kill the framerate. Don&#39;t take my word for it and try it for yourself.</p><p>Now, I should point out, the last time I tested this was with Allegro 5.0.8, so maybe things have changed since then, but considering the way al_draw_prim() works in general, sending everything to draw in a single call is just better for performance regardless of anything. :B 
</p></div></div><p>
The reason I asked you to provide proof is because the burden is on you. You&#39;re the one who says it is deficient, so you should be the one to provide proof.</p><p>A better test would be to change the # of prims drawn per second until the fps drops. That would give you a better gauge of the capabilities of allegro.</p><p>And using 5.0.8 is not a good test. That&#39;s two versions behind the latest stable release, and probably miles away from the latest unstable release. 5.1.8 would be a better test or at least 5.0.10.</p><p>I&#39;m not at home now, so I can&#39;t test anything, but maybe tomorrow I will be able to try things out.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 27 Mar 2014 22:15:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You guys are awesome. On an unrelated note, any word on when 5.1 stable will come out? (Cause you know.. still want to fill in my primitives).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Artelis)</author>
		<pubDate>Fri, 28 Mar 2014 00:48:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>5.1 stable will be 5.2... It will be out when it is ready. But there&#39;s still a lot of wok to be done, so I fear it might be a long time before we see 5.2. If you feel motivated then you could help out, though and speed this up a bit... <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (beoran)</author>
		<pubDate>Fri, 28 Mar 2014 00:54:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just so you know, just because 5.1 is called unstable doesn&#39;t mean it is unusable. 5.1.8 is perfectly usable, and if you want filled primitives I don&#39;t see any reason not to use it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 28 Mar 2014 02:07:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Absolutel what Edgar said.</p><p>&quot;Unstable&quot; refers to the API, not the stability of the library itself. It means roughy that anything that&#39;s in 5.1 and NOT in 5.0 release is <i>suject to change at any moment</i>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (pkrcel)</author>
		<pubDate>Fri, 28 Mar 2014 02:31:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614089/998581#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>The reason I asked you to provide proof is because the burden is on you. You&#39;re the one who says it is deficient, so you should be the one to provide proof.<br />A better test would be to change the # of prims drawn per second until the fps drops. That would give you a better gauge of the capabilities of allegro.<br />And using 5.0.8 is not a good test. That&#39;s two versions behind the latest stable release, and probably miles away from the latest unstable release. 5.1.8 would be a better test or at least 5.0.10.<br />I&#39;m not at home now, so I can&#39;t test anything, but maybe tomorrow I will be able to try things out.</p></div></div><p>
Well, as Tomasu pointed out earlier, it&#39;s an OpenGL thing, and I&#39;ve been stuck using OpenGL exclusively because I&#39;m working with fragment shaders using the 5.0.x branch, thus I didn&#39;t know (and no one told me) that it only affected the OpenGL side of things. I mean, I COULD go up to the 5.1.x branch, but for making something I intend to sell it makes more sense to go with the stable branch and work within and around its limitations.</p><p>So yeah, Artelis, unless you&#39;re using OpenGL graphics exclusively (or intend to give the end-user the ability to choose between Direct3D and OpenGL) you don&#39;t seem to need to worry about al_draw_prim() performance. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kris Asick)</author>
		<pubDate>Fri, 28 Mar 2014 03:28:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614089/998620#target">Kris Asick</a> said:</div><div class="quote"><p> it only affected the OpenGL side of things.</p></div></div><p>It&#39;s also a D3D thing. The APIs have a fair amount of overhead per draw call.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>for making something I intend to sell it makes more sense to go with the stable branch and work within and around its limitations.</p></div></div><p>Not sure I believe that when the actual stability is good, and has lots of bug fixes and new functionality you might want or need.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 28 Mar 2014 12:44:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Actually, if you&#39;re making a game and you plan to sell it in the next year or so, Allegro 5.1.x should be fine. API stability only matters if you&#39;re writing an application that will need very long term support. </p><p>And besides, I want to push for allegro 5.2 a bit more. Time for me to get cracking again.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (beoran)</author>
		<pubDate>Fri, 28 Mar 2014 13:24:39 +0000</pubDate>
	</item>
</rss>
