<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Day and Night Cycles</title>
		<link>http://www.allegro.cc/forums/view/617482</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 06 Jul 2018 18:23:39 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I have a ALLEGRO_COLOR cameraTint = al_map_rgba_f(1.0f, 1.0f, 1.0f, 1.0f);</p><p>Which is applied to every object that is drawn to the screen? <br />How can I effectively render a day and night cycle - <br />morning (little yellow and red light and little blue light), noon(white light), evening (little yellow and red light), night(moonlight(dark) + little green(like a night vision effect))? <br />Thanks in advance.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Sat, 30 Jun 2018 10:47:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Why don&#39;t you just try it and see what happens. :/</p><p>I gave you sample code in your other thread.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 30 Jun 2018 12:08:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hai Edgar Reynaldo, <br />I do try the blending with reference from the code you posted in the other thread - but the results don&#39;t seem very satisfactory - I am not getting a real-life feel like in the other 2D games. So my guess is I am missing something. That&#39;s why I asked. <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" /><br />Like is Thier a certain combination of rgba value that works better ... Things like that<br />Seeking expertise opinions on the matter. </p><p>I am truly sorry that I couldn&#39;t rise up to your expectation. I was just confused.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Sat, 30 Jun 2018 13:22:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The choice of color is important, but you also probably want to apply a gradient or radial gradient, not just a blanket tint.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (relpatseht)</author>
		<pubDate>Sat, 30 Jun 2018 19:09:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How are you applying it to every object? Are you drawing each object with that tint? It&#39;s much better, and more controllable, to draw one massive rectangle on the entire screen, after you&#39;ve drawn the world and objects.</p><p>Create a table that maps times of the day to colors, and in-game, draw that covering rectangle with the color and opacity corresponding to the time of day. For instance, from midday to 5 PM, you likely want a fully transparent rectangle, so everything has normal lighting. From 5 PM to 7 PM, you want a bit of an orange tint. From 7 to 8, a darker tint, with maybe a bit of blue in it, etc. You can use interpolation to fade smoothly from one color to another.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (André Silva)</author>
		<pubDate>Sat, 30 Jun 2018 19:30:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you relpatseht and André Silva,<br /><a href="https://www.allegro.cc/forums/thread/606569">https://www.allegro.cc/forums/thread/606569</a> I got a thread on gradients- I will try that for sure.<br />How are you applying it to every object? <br />Well as you guessed, all object&#39;s are drawn using the same tint. Someone said that even though we use different versions of al_draw-... all are basically calling the same function al_draw_tinted_scaled_rotated_bitmap - hence I won&#39;t be having any additional overheads. So my RenderingEngine class have overloaded functions that use the cameraTint if no other tint is explicitly specified. Interpolation is, however, a new word for me <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /> Let me dig deep into the mechanisms you briefed - I will try to implement it as well as I can. <br />Thank you for your expert opinions. <br />All of my work till today is here at- <a href="https://github.com/ThinkalVB/NearEarth">https://github.com/ThinkalVB/NearEarth</a><br />Feel free to make suggestions or changes.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Sat, 30 Jun 2018 21:29:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I had a really nice lighting demo around here somewhere and now I can&#39;t find it. <img src="http://www.allegro.cc/forums/smileys/angry.gif" alt="&gt;:(" />...</p><p>SEEK AND YE SHALL FIND</p><p><span class="remote-thumbnail"><span class="json">{"name":"611618","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/6\/c6fd320a4c56f234d30cd75a45d6ab40.png","w":1026,"h":801,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/6\/c6fd320a4c56f234d30cd75a45d6ab40"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/c/6/c6fd320a4c56f234d30cd75a45d6ab40-240.jpg" alt="611618" width="240" height="187" /></span></p><p>Found it. <img src="http://www.allegro.cc/forums/smileys/angry.gif" alt="&gt;:(" /> Took me a google image search with a screenshot I had taken of it to find the allegro thread where I posted the code I no longer can find.</p><p>So, here&#39;s a little lighting demo.</p><p><a href="https://www.allegro.cc/files/attachment/611617">Lighting.zip</a></p><p>It should open a full screen window and the light source will follow the mouse showing the background beneath.</p><p>The code you need to know is :
</p><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="number">  2</span><a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a><span class="k3">*</span> bg <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">"BG.png"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  3</span><a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a><span class="k3">*</span> light <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>screenw,screenh<span class="k2">)</span><span class="k2">;</span>
<span class="number">  4</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>light<span class="k2">)</span><span class="k2">;</span>
<span class="number">  5</span><span class="c">/// Clear to black</span>
<span class="number">  6</span><a href="http://www.allegro.cc/manual/al_clear_to_color"><span class="a">al_clear_to_color</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/al_map_rgba"><span class="a">al_map_rgba</span></a><span class="k2">(</span><span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">255</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  7</span><a href="http://www.allegro.cc/manual/al_set_blender"><span class="a">al_set_blender</span></a><span class="k2">(</span>ALLEGRO_ADD , ALLEGRO_ONE , ALLEGRO_ONE<span class="k2">)</span><span class="k2">;</span>
<span class="number">  8</span><span class="c">/// Draw our lights using additive blending</span>
<span class="number">  9</span><a href="http://www.allegro.cc/manual/al_draw_filled_circle"><span class="a">al_draw_filled_circle</span></a><span class="k2">(</span>x1,y1,r1,<a href="http://www.allegro.cc/manual/al_map_rgba"><span class="a">al_map_rgba</span></a><span class="k2">(</span><span class="n">255</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">255</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 10</span><a href="http://www.allegro.cc/manual/al_draw_filled_circle"><span class="a">al_draw_filled_circle</span></a><span class="k2">(</span>x2,y2,r2,<a href="http://www.allegro.cc/manual/al_map_rgba"><span class="a">al_map_rgba</span></a><span class="k2">(</span><span class="n">0</span>,<span class="n">255</span>,<span class="n">0</span>,<span class="n">255</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 11</span><a href="http://www.allegro.cc/manual/al_draw_filled_circle"><span class="a">al_draw_filled_circle</span></a><span class="k2">(</span>x3,y3,r3,<a href="http://www.allegro.cc/manual/al_map_rgba"><span class="a">al_map_rgba</span></a><span class="k2">(</span><span class="n">0</span>,<span class="n">0</span>,<span class="n">255</span>,<span class="n">255</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 12</span><span class="c">/// Reset default blender</span>
<span class="number"> 13</span><a href="http://www.allegro.cc/manual/al_set_blender"><span class="a">al_set_blender</span></a><span class="k2">(</span>ALLEGRO_ADD , ALLEGRO_INVERSE_ALPHA , ALLEGRO_ALPHA<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 14</span><span class="c">/// Draw on backbuffer</span>
<span class="number"> 15</span><a href="http://www.allegro.cc/manual/al_set_target_backbuffer"><span class="a">al_set_target_backbuffer</span></a><span class="k2">(</span>d<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 16</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>bg<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 17</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>bg<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 18</span><a href="http://www.allegro.cc/manual/al_draw_bitmap"><span class="a">al_draw_bitmap</span></a><span class="k2">(</span>bg , <span class="k2">(</span>screenw <span class="k3">-</span> w<span class="k2">)</span><span class="k3">/</span><span class="n">2</span> , <span class="k2">(</span>screenh <span class="k3">-</span> h<span class="k2">)</span><span class="k3">/</span><span class="n">2</span> , <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 19</span><span class="c">/// Draw lights using multiply blender</span>
<span class="number"> 20</span><a href="http://www.allegro.cc/manual/al_set_blender"><span class="a">al_set_blender</span></a><span class="k2">(</span>ALLEGRO_ADD , ALLEGRO_DEST_COLOR , ALLEGRO_ZERO<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 21</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>light<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 22</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>light<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 23</span><a href="http://www.allegro.cc/manual/al_draw_bitmap"><span class="a">al_draw_bitmap</span></a><span class="k2">(</span>light , mousex <span class="k3">-</span> w<span class="k3">/</span><span class="n">2</span> , mousey <span class="k3">-</span> h<span class="k3">/</span><span class="n">2</span> , <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 24</span><a href="http://www.allegro.cc/manual/al_flip_display"><span class="a">al_flip_display</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
</div></div><p>

If you&#39;re just not satisfied with multiply blending, then you&#39;ll have to look into additive blending.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 02 Jul 2018 22:20:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you Edgar Reynaldo, <br />Lighting.zip was superb.<br />So when to use additive and multiplicative blending?</p><p>If I am understanding it right - What I got as the basic logic is - Make a bitmap, color it full black. Then draw the lights in it (call it a lightMap). Then draw the lightmap above the background. <br />And while drawing the lightMap you can use additive or multiplicative blending - so the mixing of colors works fine.<br />I am right - or am I getting it wrong? </p><p>In my project </p><p>step 1) clear display backBuffer with black<br />step 2) clear the lightMap with daylight or cameraTint<br />step 3) draw the background texture</p><p>step 4) draw lights to lightmap <br />step 4) draw objects to the display back buffer</p><p>step 5) When rendering of objects complete<br />step 6) Draw the lightmap in the display buffer<br />[This means I no more need to apply the camera tint to every object drawn on the display buffer]<br />Some results attached - when I used additive and multiplicative blending while drawing the lightMap to the back buffer for 	RenderingEngine::setCameraTint(al_map_rgba(50,50,50,250)); - It&#39;s night <img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" /><img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /><img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p><b> Edit </b> How to fade the light - controlling the luminosity ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Tue, 03 Jul 2018 16:27:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah, you&#39;ve pretty much got it.</p><p>For altering the luminosity, all you do is vary the white level. The color gets multiplied so it will darken the subject by it&#39;s black level. If you mean true luminosity like HSL, you need additive blending because multiply can only decrease the color values.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 04 Jul 2018 18:17:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you Edgar Reynaldo, <br />I think i should stick to additive blending in the lightMap (for all the lights in the scene). <br />One more question - how to decrease the intensity with the distance - (at the origin - intensity 100% and as we move away it should decrease to 0). One way I figured out is to use a for loop while drawing filled circles. However, it&#39;s not working as I intended. 
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_set_blender"><span class="a">al_set_blender</span></a><span class="k2">(</span>ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE<span class="k2">)</span><span class="k2">;</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>lightMap<span class="k2">)</span><span class="k2">;</span>
      
<span class="k1">for</span> <span class="k2">(</span><span class="k1">int</span> radii <span class="k3">=</span> <span class="n">100</span><span class="k2">;</span> radii <span class="k3">!</span><span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> radii--<span class="k2">)</span>
<span class="k2">{</span>
<a href="http://www.allegro.cc/manual/al_draw_filled_circle"><span class="a">al_draw_filled_circle</span></a><span class="k2">(</span><span class="n">600</span>, <span class="n">500</span>, radii, <a href="http://www.allegro.cc/manual/al_map_rgba"><span class="a">al_map_rgba</span></a><span class="k2">(</span><span class="n">255</span>, <span class="n">0</span>, <span class="n">0</span>, <span class="n">1</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
switchToDisplayBuffer<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

But I think drawing 255 primitives for every light 60 frames per second is very unethical or compute intensive for some reason. Is there a better way to get it done? (faster and clean)??????<br />Also, I came to know that allegro primitives don&#39;t follow the usual transformation. So how to make them follow it?.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Thu, 05 Jul 2018 11:28:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Allegro uses pre-multiplied alpha.</p><p>That means you have to multiply by the alpha when you pass it to al_map_rgb*.</p><p>Use al_map_rgba_f. Then it&#39;s clearer.
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_set_blender"><span class="a">al_set_blender</span></a><span class="k2">(</span>ALLEGRO_ADD , ALLEGRO_ONE , ALLEGRO_ZERO<span class="k2">)</span><span class="k2">;</span>
<span class="k1">float</span> a <span class="k3">=</span> <span class="n">0</span>.<span class="n">5</span><span class="k2">;</span>
<span class="k1">for</span> <span class="k2">(</span><span class="k1">int</span> i <span class="k3">=</span> <span class="n">100</span> <span class="k2">;</span> i <span class="k3">&gt;</span><span class="k3">=</span> <span class="n">1</span> <span class="k2">;</span> <span class="k3">-</span><span class="k3">-</span>i<span class="k2">)</span> <span class="k2">{</span>
   <span class="k1">float</span> a2 <span class="k3">=</span> a<span class="k3">/</span><span class="k2">(</span><span class="k1">float</span><span class="k2">)</span>i<span class="k2">;</span>
   <a href="http://www.allegro.cc/manual/al_draw_filled_circle"><span class="a">al_draw_filled_circle</span></a><span class="k2">(</span>x,y,i,<a href="http://www.allegro.cc/manual/al_map_rgba_f"><span class="a">al_map_rgba_f</span></a><span class="k2">(</span>r<span class="k3">*</span>a2 , g<span class="k3">*</span>a2 , b<span class="k3">*</span>a2 , a2<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 05 Jul 2018 21:58:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ah thank you Edgar Reynaldo,</p><p>I forgot that one. I corrected the code the result is pretty promising. But don&#39;t have any idea why a special region is more illuminated than it&#39;s center. Any thoughts? </p><p>But I have one simple honest doubt - If it uses pre-multiplied alpha - why we even have to pass the alpha value to the function. Because both seem to produce the same result?</p><p>It would be great if you could comment on the transformations in the allegro primitives and any easy or clean way to draw the lights - more efficiently?</p><p>One more thing if I have RGB values as 255,144,245 then how can I convert it to float values - to do the pre-multiplied alpha thing? <img src="http://www.allegro.cc/forums/smileys/lipsrsealed.gif" alt=":-X" /><img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" /><img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /><img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" /><img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" /><img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" /><img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Thu, 05 Jul 2018 23:05:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If you want to use al_map_rgba, then multiply by alpha and divide by 255.</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">unsigned</span> <span class="k1">char</span> r <span class="k3">=</span> <span class="n">255</span> , g <span class="k3">=</span> <span class="n">0</span> , b <span class="k3">=</span> <span class="n">0</span> , a <span class="k3">=</span> <span class="n">127</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_map_rgba"><span class="a">al_map_rgba</span></a><span class="k2">(</span>r<span class="k3">*</span>a<span class="k3">/</span><span class="n">255</span> , g<span class="k3">*</span>a<span class="k3">/</span><span class="n">255</span> , b<span class="k3">*</span>a<span class="k3">/</span><span class="n">255</span> , a<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

The key to drawing a gradient is that you need to divide by the radius or something else so that when you draw multiple circles it adds up to the right amount. That&#39;s why I suggested you use al_map_rgba_f. See the code in my Lighting.zip file for details. It&#39;s the DrawLightA function I think.</p><p>If you need to reset the transforms, the manual explains it well in <a href="https://liballeg.org/a5docs/trunk/transformations.html#al_use_projection_transform">al_use_projection_transform</a>. For the view transform, just reset it to identity. You can use <a href="https://liballeg.org/a5docs/trunk/transformations.html#al_get_current_transform">al_get_current_transform</a> and <a href="https://liballeg.org/a5docs/trunk/transformations.html#al_get_current_projection_transform">al_get_current_projection_transform</a> to see what is currently set or to reset it when you&#39;re done.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 05 Jul 2018 23:39:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you Edgar Reynaldo, </p><p>My player character is at 1500,1500 but I am drawing the light at 500,600 and both use the same transformation. So essentially the light shouldn&#39;t show up on the screen. But you see the result - the light is showing up at the display co-ordinate 500,600. That&#39;s the problem. <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Thu, 05 Jul 2018 23:44:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You have to draw the light at the coordinates of the player. <s>That means you have to apply the transform you&#39;re using for your player to the coordinates of the light you want to draw.</s></p><p>Show code and I can help better.</p><p>EDIT<br />Use <a href="https://liballeg.org/a5docs/trunk/transformations.html#al_transform_coordinates">al_transform_coordinates</a> to fix the light position.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 05 Jul 2018 23:52:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you Edgar Reynaldo, <br />This is more controllable and better I think. 
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">float</span> alpha <span class="k3">=</span> <span class="n">1</span>.<span class="n">0f</span><span class="k2">;</span>
<span class="k1">float</span> gradient <span class="k3">=</span> <span class="n">30</span>.<span class="n">0f</span><span class="k2">;</span>
<span class="k1">float</span> radius <span class="k3">=</span> <span class="n">100</span>.<span class="n">0f</span><span class="k2">;</span>

<span class="k1">float</span> dGradient <span class="k3">=</span> radius <span class="k3">/</span> gradient<span class="k2">;</span>
<span class="k1">float</span> dAlpha <span class="k3">=</span> alpha <span class="k3">/</span> gradient<span class="k2">;</span>

<span class="k1">for</span> <span class="k2">(</span><span class="k1">auto</span> radii <span class="k3">=</span> <span class="n">1</span>.<span class="n">0f</span><span class="k2">;</span> radii <span class="k3">&lt;</span><span class="k3">=</span> radius<span class="k2">;</span> radii <span class="k3">+</span><span class="k3">=</span> dGradient<span class="k2">)</span>
<span class="k2">{</span>
<a href="http://www.allegro.cc/manual/al_draw_circle"><span class="a">al_draw_circle</span></a><span class="k2">(</span><span class="n">500</span>, <span class="n">600</span>, radii, <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">0f</span><span class="k3">*</span>alpha, <span class="n">0</span>.<span class="n">0f</span><span class="k3">*</span>alpha, <span class="n">0</span>.<span class="n">0f</span><span class="k3">*</span>alpha<span class="k2">)</span>, dGradient<span class="k2">)</span><span class="k2">;</span>
alpha <span class="k3">-</span><span class="k3">=</span> dAlpha<span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>
Full source code is in Git and is up-todate till this minute. [issue: lightMap is not using the transformation]<br /><a href="https://github.com/ThinkalVB/NearEarth">https://github.com/ThinkalVB/NearEarth</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Fri, 06 Jul 2018 00:11:17 +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/617482/1038376#target">Thinkal VB</a> said:</div><div class="quote"><p>
Full source code is in Git and is up-todate till this minute. [issue: lightMap is not using the transformation]
</p></div></div><p>
Oh I see what you&#39;re saying now. Of course it&#39;s not using the transformation. There are two transforms per bitmap target. If you change the target bitmap, the transforms are reset to the stored version.</p><p>You&#39;ve got to learn about relative coordinates and transforming from one space to another.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 06 Jul 2018 17:09:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you Edgar Reynaldo, <br />I didn&#39;t quite get it. <br /><u>
There are two transforms per bitmap target. If you change the target bitmap, the transforms are reset to the stored version.</u><br />stored version? </p><p>Did you mean there are two transformations related to a bitmap? [like an active and default tranforms] Once you switch to another target bitmap the default transformation&#39;s come into effect and once you switch back, the old transformation will be restored????</p><p>Isn&#39;t there a way to use the same transformation for both the lightMap bitmap and the display&#39;s back buffer?:P:-/
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Fri, 06 Jul 2018 17:25:18 +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/617482/1038380#target">Thinkal VB</a> said:</div><div class="quote"><p>
Isn&#39;t there a way to use the same transformation for both the lightMap bitmap and the display&#39;s back buffer?:P:-/ 
</p></div></div><p>
Yes, just set the transform again. Every time you set the target bitmap, it&#39;s stored transformations get restored.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 06 Jul 2018 17:28:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you Edgar Reynaldo, <br />I was very much confused and worried - I thought transforms won&#39;t work with primitives.<br />One more thing <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /> <br />I have a bright sun in the scene - </p><div class="source-code snippet"><div class="inner"><pre>  RenderingEngine::setCameraTint<span class="k2">(</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">250</span>, <span class="n">250</span>, <span class="n">250</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
Then I tried to draw a light in the scene - same as the one above. However when using additive blending - it&#39;s the same color everywhere (no change - as it is supposed to be). Then I tried multiplicative blending but it was an absolute horror. <br />So possibly which blending mode should I use in such a bright background light scenario????:)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Fri, 06 Jul 2018 17:52:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Without showing code I can&#39;t help much. Commit and push or post code.</p><p>When drawing the lights themselves, you use additive blending. When drawing the lightMap on your scene, you use multiplicative blending.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 06 Jul 2018 18:07:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you Edgar Reynaldo, <br />I am sorry - I totally forgot to sync it to Git. It&#39;s done now. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /><br />I was doing quite the opposite - For lightmap using additive blending and when drawing the light map over the back buffer I was using multiplicative blending. <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" /><img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" /><img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" /><br />If I use the blending vice verse - the background seems to be fully white.::)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Fri, 06 Jul 2018 18:23:39 +0000</pubDate>
	</item>
</rss>
