<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Learn OpenGL</title>
		<link>http://www.allegro.cc/forums/view/617205</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 31 Jan 2018 01:48:41 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I just found the best OpenGL tutorials I have seen on the net in years!</p><p><a href="https://learnopengl.com/">https://learnopengl.com/</a></p><p>...it teaches modern OpenGL, the basics and advanced topics in a really nice way.  I managed to achieve a lot and he teaches how to do it properly!  No immediate mode garbage, but properly coded shaders etc... it&#39;s been a lot of fun following this and I just had to share it here.</p><p>He used GLFW for this, but the way he teaches it, you could easily pick your library to use it, just swap the various GLFW functions to whatever.  Probably Allegro, or SDL etc... wouldn&#39;t be difficult.</p><p><span class="remote-thumbnail"><span class="json">{"name":"611195","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/5\/c56411813895b429c3e52ce278753562.jpg","w":791,"h":594,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/5\/c56411813895b429c3e52ce278753562"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/c/5/c56411813895b429c3e52ce278753562-240.jpg" alt="611195" width="240" height="180" /></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Fri, 05 Jan 2018 10:47:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah these tutorials are very well done and certainly the best I&#39;ve been seen at explaining a lot of the 3D concepts (transformations, matrices, etc).</p><p>I wanted to re-do his &#39;In Practice: 2D Breakout Game&#39; with Allegro 5 but alas, I haven&#39;t had the time.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Samuel Henderson)</author>
		<pubDate>Wed, 10 Jan 2018 05:30:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Very nice! Even goes through PBR! I&#39;m tempted to do some C++ again hehe.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc ( Arvidsson)</author>
		<pubDate>Wed, 10 Jan 2018 13:36:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah, it&#39;s been pretty kewl to learn the right way to do things for a change.  </p><p>He uses GLFW, but there&#39;s no reason why someone couldn&#39;t use Allegro, SDL2 or whatever you prefer.</p><p>I was used to using GLEW in the past, but I he uses something called GLAD and I love it as it is a header file only which I like.  No precompiled needed etc... his image loader is the same.  I have been doing it his way, but I may rewrite some of what I have learned using Code::Blocks and something else, Allegro or SDL2.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Wed, 10 Jan 2018 14:25:42 +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/617205/1034463#target">Neil Roy</a> said:</div><div class="quote"><p>I was used to using GLEW in the past, but I he uses something called GLAD and I love it as it is a header file only which I like. No precompiled needed etc... his image loader is the same.</p></div></div><p>

Yeah.  When I was looking at his stuff a couple of years ago he was using SOIL (Simple Opengl Image Library)... I had to jump through all sorts of hoops to get that library working in Windows, Linux and macOS.  At some point he switched to stb_image ... which makes things SO MUCH SIMPLER.  Just add stb_image.h to your project and call stbi_load(...) and bam: here&#39;s an unsigned char * to the image data.</p><p>Also, Neil Roy, is this you?:<br /><a href="https://youtu.be/ZxMx2NUT5sw?t=112">https://youtu.be/ZxMx2NUT5sw?t=112</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Samuel Henderson)</author>
		<pubDate>Fri, 12 Jan 2018 04:53: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/617205/1034482#target">Samuel Henderson</a> said:</div><div class="quote"><p> and bam: here&#39;s an unsigned char * to the image data.</p></div></div><p>You lied, where is my unsigned char * to this mystery image data? <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" /> <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p>I started these when Neil posted them a week or so ago on another thread (or maybe here, I don&#39;t know). It&#39;s still hard to find the energy to learn this stuff after work, but it&#39;s nice to dabble in it at least.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bamccaig)</author>
		<pubDate>Fri, 12 Jan 2018 06:26:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>A long time ago I was trying to get into OpenGL and I was making a &quot;space&quot; version of Minecraft where you could build ships and fly them around.</p><p><span class="remote-thumbnail"><span class="json">{"name":"O8DGS9c.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/5\/4566f393bc13fff1dae8ab95cce0d64e.jpg","w":812,"h":638,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/5\/4566f393bc13fff1dae8ab95cce0d64e"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/4/5/4566f393bc13fff1dae8ab95cce0d64e-240.jpg" alt="O8DGS9c.jpg" width="240" height="188" /></span></p><p>Years later, Space Engineers came out. They totally ripped me off. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Fri, 12 Jan 2018 08:09: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/617205/1034484#target">bamccaig</a> said:</div><div class="quote"><p>I started these when Neil posted them a week or so ago on another thread (or maybe here, I don&#39;t know). It&#39;s still hard to find the energy to learn this stuff after work, but it&#39;s nice to dabble in it at least.</p></div></div><p>

I used to dabble with these tutorials too.  Then my employer decided to pay me to do a bunch of OpenGL Core profile work.  That tremendously accelerates the learning process ... being able to focus on learning and using OpenGL for 8+ hours a day.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Samuel Henderson)</author>
		<pubDate>Fri, 12 Jan 2018 10:30:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>@ Chris Katko<br />Finish it anyway !  <br />You might be able to make it better <img src="http://www.allegro.cc/forums/smileys/cool.gif" alt="8-)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ariesnl)</author>
		<pubDate>Fri, 12 Jan 2018 13:55:38 +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/617205/1034482#target">Samuel Henderson</a> said:</div><div class="quote"><p>Also, Neil Roy, is this you?:</p></div></div><p>

Yeah, kewl, I didn&#39;t know he mentioned my little program.  Thanks for letting me know.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617205/1034485#target">Chris Katko</a> said:</div><div class="quote"><p>Years later, Space Engineers came out. They totally ripped me off. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p></div></div><p>

I agree, you should continue it.  You started with your own idea, keep going your own way, you may end up with something far superior.</p><p>I want to convert all his examples to SDL2 + C, no C++, no classes. Could be fun as I feel much more at ease with pure C.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Fri, 12 Jan 2018 16:59:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think I have somewhere around a wrapper I made at least for the initial tutorials that used Allegro instead of GLFW, I recall it almost mapped 1:1 with ease. Bumping this to see if I find it and post it on GitHub or something.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Rodolfo Lam)</author>
		<pubDate>Tue, 16 Jan 2018 05:03:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I just read through the advanced tutorial on instancing, wow, that one will be REALLY valuable!  He renders 100,000 asteroids on screen without much of a performance hit.  I could have used this in my old terrain program I wrote years ago.  Using immediate mode OpenGL (fixed pipeline), and with my tree numbers maxxed out, I got 1 FPS! LMAO  With instancing I shouldn&#39;t see much of a hit at all which is uber kewl.</p><p><span class="remote-thumbnail"><span class="json">{"name":"611208","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/6\/d60249d72a7cd912fe7b359e69db05df.jpg","w":1280,"h":720,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/6\/d60249d72a7cd912fe7b359e69db05df"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/d/6/d60249d72a7cd912fe7b359e69db05df-240.jpg" alt="611208" width="240" height="135" /></span></p><p>He also had some great tips on skybox&#39;s, which I already understood (screenshot above used one I created back then).  One of his tips should help increase efficiency with them too, and that was to render the skybox LAST, which I would never do normally, but with the right settings, it would be more efficient as the fragments of the skybox that are not visible would simply not be drawn at all using a depth buffer trick he mentioned.  Each fragment would be checked against the depth buffer and would not be drawn if it wasn&#39;t visible due to something else already being there.</p><p>Contrast that with how you normally do it.  Turn depth testing off, draw the skybox first, then the objects closer, then turn depth testing on.  The result is you draw the entire visible skybox whether it is blocked or not, where as using his trick, only the parts not blocked by closer objects are seen = more efficient.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617205/1034569#target">Rodolfo Lam</a> said:</div><div class="quote"><p>I think I have somewhere around a wrapper I made at least for the initial tutorials that used Allegro instead of GLFW, I recall it almost mapped 1:1 with ease. Bumping this to see if I find it and post it on GitHub or something.</p></div></div><p>

That would be interesting!  I would love to see some high quality 3D stuff done with Allegro.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Tue, 16 Jan 2018 12:42:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hmm I can&#39;t make glad work with allegro for some reason.</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_set_new_display_flags"><span class="a">al_set_new_display_flags</span></a><span class="k2">(</span>ALLEGRO_OPENGL_3_0<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_set_new_display_option"><span class="a">al_set_new_display_option</span></a><span class="k2">(</span>ALLEGRO_OPENGL_MAJOR_VERSION, <span class="n">3</span>, ALLEGRO_REQUIRE<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_set_new_display_option"><span class="a">al_set_new_display_option</span></a><span class="k2">(</span>ALLEGRO_OPENGL_MINOR_VERSION, <span class="n">3</span>, ALLEGRO_REQUIRE<span class="k2">)</span><span class="k2">;</span>
display <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>width, height<span class="k2">)</span><span class="k2">;</span>
<span class="k1">if</span> <span class="k2">(</span><span class="k3">!</span>display<span class="k2">)</span> <span class="k1">return</span> <span class="k3">-</span><span class="n">1</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_set_current_opengl_context"><span class="a">al_set_current_opengl_context</span></a><span class="k2">(</span>display<span class="k2">)</span><span class="k2">;</span>

<span class="k1">if</span> <span class="k2">(</span><span class="k3">!</span>gladLoadGLLoader<span class="k2">(</span><span class="k2">(</span>GLADloadproc<span class="k2">)</span><a href="http://www.allegro.cc/manual/al_get_opengl_proc_address"><span class="a">al_get_opengl_proc_address</span></a><span class="k2">)</span><span class="k2">)</span> <span class="k1">return</span> <span class="k3">-</span><span class="n">2</span><span class="k2">;</span>
</pre></div></div><p>

I tried the above but the call to gladLoadGLLoader fails. Any idea what might be wrong?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc ( Arvidsson)</author>
		<pubDate>Wed, 17 Jan 2018 02:41:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Wish I could help, never used Allegro with anything 3D before. :/  You could try using GLEW instead, see if that works.  It shouldn&#39;t matter which one you use to be honest.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Wed, 17 Jan 2018 04:30:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>My only guess would be that the glad that you have doesn&#39;t match the OpenGL that Allegro is using? Try to regenerate GLAD to match I guess?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bamccaig)</author>
		<pubDate>Wed, 17 Jan 2018 23:39:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Good idea. I tried it out and something is not right. I get the version 0 from al_get_opengl_version. I printed it out as hex and it was 0.</p><p>I link against opengl32.lib.</p><p>This is the code:</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="p">#include &lt;glad/glad.h&gt;</span>
<span class="number">  2</span><span class="p">#include &lt;allegro5/allegro.h&gt;</span>
<span class="number">  3</span><span class="p">#include &lt;allegro5/allegro_opengl.h&gt;</span>
<span class="number">  4</span><span class="p">#include &lt;iostream&gt;</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>    <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">  9</span>    <a href="http://www.allegro.cc/manual/al_set_new_display_flags"><span class="a">al_set_new_display_flags</span></a><span class="k2">(</span>ALLEGRO_OPENGL_3_0<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 10</span>    <a href="http://www.allegro.cc/manual/al_set_new_display_option"><span class="a">al_set_new_display_option</span></a><span class="k2">(</span>ALLEGRO_OPENGL_MAJOR_VERSION, <span class="n">3</span>, ALLEGRO_REQUIRE<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 11</span>    <a href="http://www.allegro.cc/manual/al_set_new_display_option"><span class="a">al_set_new_display_option</span></a><span class="k2">(</span>ALLEGRO_OPENGL_MINOR_VERSION, <span class="n">3</span>, ALLEGRO_REQUIRE<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 12</span>    <a href="http://www.allegro.cc/manual/ALLEGRO_DISPLAY"><span class="a">ALLEGRO_DISPLAY</span></a> <span class="k3">*</span>display <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"> 13</span>    <span class="k1">if</span> <span class="k2">(</span><span class="k3">!</span>display<span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 14</span>        std::cout <span class="k3">&lt;</span><span class="k3">&lt;</span> <span class="s">"Failed to create display"</span><span class="k2">;</span>
<span class="number"> 15</span>        <span class="k1">return</span> <span class="k3">-</span><span class="n">1</span><span class="k2">;</span>
<span class="number"> 16</span>    <span class="k2">}</span>
<span class="number"> 17</span>    <a href="http://www.allegro.cc/manual/al_set_current_opengl_context"><span class="a">al_set_current_opengl_context</span></a><span class="k2">(</span>display<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 18</span>    std::cout <span class="k3">&lt;</span><span class="k3">&lt;</span> <span class="s">"OpenGL Version: "</span> <span class="k3">&lt;</span><span class="k3">&lt;</span> std::hex <span class="k3">&lt;</span><span class="k3">&lt;</span> <a href="http://www.allegro.cc/manual/al_get_opengl_version"><span class="a">al_get_opengl_version</span></a><span class="k2">(</span><span class="k2">)</span> <span class="k3">&lt;</span><span class="k3">&lt;</span> std::endl<span class="k2">;</span>
<span class="number"> 19</span>
<span class="number"> 20</span>    <a href="http://www.allegro.cc/manual/ALLEGRO_TIMER"><span class="a">ALLEGRO_TIMER</span></a> <span class="k3">*</span>timer <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_timer"><span class="a">al_create_timer</span></a><span class="k2">(</span><span class="n">1</span>.<span class="n">0</span> <span class="k3">/</span> <span class="n">60</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 21</span>    <a href="http://www.allegro.cc/manual/ALLEGRO_EVENT_QUEUE"><span class="a">ALLEGRO_EVENT_QUEUE</span></a> <span class="k3">*</span>event_queue <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_event_queue"><span class="a">al_create_event_queue</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_register_event_source"><span class="a">al_register_event_source</span></a><span class="k2">(</span>event_queue, <a href="http://www.allegro.cc/manual/al_get_display_event_source"><span class="a">al_get_display_event_source</span></a><span class="k2">(</span>display<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 23</span>    <a href="http://www.allegro.cc/manual/al_register_event_source"><span class="a">al_register_event_source</span></a><span class="k2">(</span>event_queue, <a href="http://www.allegro.cc/manual/al_get_timer_event_source"><span class="a">al_get_timer_event_source</span></a><span class="k2">(</span>timer<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 24</span>
<span class="number"> 25</span>    <span class="k1">if</span> <span class="k2">(</span><span class="k3">!</span>gladLoadGLLoader<span class="k2">(</span><span class="k2">(</span>GLADloadproc<span class="k2">)</span><a href="http://www.allegro.cc/manual/al_get_opengl_proc_address"><span class="a">al_get_opengl_proc_address</span></a><span class="k2">)</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 26</span>        std::cout <span class="k3">&lt;</span><span class="k3">&lt;</span> <span class="s">"Failed to load opengl"</span><span class="k2">;</span>
<span class="number"> 27</span>        <span class="k1">return</span> <span class="k3">-</span><span class="n">1</span><span class="k2">;</span>
<span class="number"> 28</span>    <span class="k2">}</span>
<span class="number"> 29</span>    
<span class="number"> 30</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_rgb"><span class="a">al_map_rgb</span></a><span class="k2">(</span><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="k2">;</span>
<span class="number"> 31</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>
<span class="number"> 32</span>    <a href="http://www.allegro.cc/manual/al_start_timer"><span class="a">al_start_timer</span></a><span class="k2">(</span>timer<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 33</span>    <span class="k1">bool</span> redraw <span class="k3">=</span> <span class="k1">true</span><span class="k2">;</span>
<span class="number"> 34</span>
<span class="number"> 35</span>    <span class="k1">while</span> <span class="k2">(</span><span class="n">1</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 36</span>        <a href="http://www.allegro.cc/manual/ALLEGRO_EVENT"><span class="a">ALLEGRO_EVENT</span></a> ev<span class="k2">;</span>
<span class="number"> 37</span>        <a href="http://www.allegro.cc/manual/al_wait_for_event"><span class="a">al_wait_for_event</span></a><span class="k2">(</span>event_queue, <span class="k3">&amp;</span>ev<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 38</span>
<span class="number"> 39</span>        <span class="k1">if</span> <span class="k2">(</span>ev.type <span class="k3">=</span><span class="k3">=</span> ALLEGRO_EVENT_TIMER<span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 40</span>            redraw <span class="k3">=</span> <span class="k1">true</span><span class="k2">;</span>
<span class="number"> 41</span>        <span class="k2">}</span>
<span class="number"> 42</span>        <span class="k1">else</span> <span class="k1">if</span> <span class="k2">(</span>ev.type <span class="k3">=</span><span class="k3">=</span> ALLEGRO_EVENT_DISPLAY_CLOSE<span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 43</span>            <span class="k1">break</span><span class="k2">;</span>
<span class="number"> 44</span>        <span class="k2">}</span>
<span class="number"> 45</span>
<span class="number"> 46</span>        <span class="k1">if</span> <span class="k2">(</span>redraw <span class="k3">&amp;</span><span class="k3">&amp;</span> al_event_queue_is_empty<span class="k2">(</span>event_queue<span class="k2">)</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 47</span>            redraw <span class="k3">=</span> <span class="k1">false</span><span class="k2">;</span>
<span class="number"> 48</span>            glClearColor<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">3f</span>, <span class="n">0</span>.<span class="n">3f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 49</span>            glClear<span class="k2">(</span>GL_COLOR_BUFFER_BIT<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 50</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>
<span class="number"> 51</span>        <span class="k2">}</span>
<span class="number"> 52</span>    <span class="k2">}</span>
<span class="number"> 53</span>
<span class="number"> 54</span>    <a href="http://www.allegro.cc/manual/al_destroy_timer"><span class="a">al_destroy_timer</span></a><span class="k2">(</span>timer<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 55</span>    <a href="http://www.allegro.cc/manual/al_destroy_display"><span class="a">al_destroy_display</span></a><span class="k2">(</span>display<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 56</span>    <a href="http://www.allegro.cc/manual/al_destroy_event_queue"><span class="a">al_destroy_event_queue</span></a><span class="k2">(</span>event_queue<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 57</span>
<span class="number"> 58</span>    <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 59</span><span class="k2">}</span>
</div></div><p>

Any idea what else might be wrong here?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc ( Arvidsson)</author>
		<pubDate>Thu, 18 Jan 2018 22:02:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Are you drivers up to date? Also, you might try adding in <span class="source-code">ALLEGRO_OPENGL</span> to your <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_new_display_flags"><span class="a">al_set_new_display_flags</span></a></span> call.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 18 Jan 2018 23:46:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve had tons of problems with mismatched libraries that were compiled at different times, or from ever-so-slightly different sub-versions between include files and binaries.</p><p>They may even not break ALL functions! Sometimes they only break SOME! <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" /> Until you realize what&#39;s going on, it will give you a headache for why only one function will blow up (&quot;how can &#39;half a library&#39; break!?&quot;)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Fri, 19 Jan 2018 06:55:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I can has questions.</p><p>How do you handle the poles with a skybox?</p><p>How do you render a quad in modern OpenGL?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 21 Jan 2018 02:49:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Somehow I doubt you don&#39;t know this stuff Edgar, but... </p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617205/1034679#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>How do you handle the poles with a skybox?</p></div></div><p>

I&#39;m not sure what you mean?  You talking about rotations?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>How do you render a quad in modern OpenGL?</p></div></div><p>

You create two triangles...</p><p><span class="remote-thumbnail"><span class="json">{"name":"611214","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/f\/af696c4f2afee676b9b97743c2b3f98e.jpg","w":500,"h":500,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/f\/af696c4f2afee676b9b97743c2b3f98e"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/a/f/af696c4f2afee676b9b97743c2b3f98e-240.jpg" alt="611214" width="240" height="239" /></span></p><p>The first triangle would be something like vertices 0, 2 and 1, and the second would be 1, 2, 3.  Or you could create a triangle strip with 0, 2, 1, 3.  OR you could just specify GL_QUADS, but that may or may not work as they have been depreciated, though personally, I doubt very much that they will disappear anytime soon as that would wreck backwards compatibility, and who wants to sell a card that does that, especially with the growing nostalgia for older games these days.</p><p>Personally, I stick with triangles for everything as you can easily store lists of vertices and lists of indexes for polygons (triangles) and you don&#39;t have to worry about the different types etc.  Plus you want them all triangles anyhow so you can do the various occlusion tests, collision tests, lighting etc.</p><p>In other news, I done some of the Advanced OpenGL - Instancing part of the tutorials and I am blown away at what that can do!!!  In this screenshot I am rendering 10000 asteroids which all have 570+ polygons each plus the planet which has over 4000 and getting 91FPS (bottom right corner) without any culling or other optimizations!  This is really kewl stuff.</p><p><span class="remote-thumbnail"><span class="json">{"name":"611215","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/6\/965fbb75d6b8fac26aba174b69d7b5fa.jpg","w":1280,"h":720,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/6\/965fbb75d6b8fac26aba174b69d7b5fa"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/9/6/965fbb75d6b8fac26aba174b69d7b5fa-240.jpg" alt="611215" width="240" height="135" /></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Sun, 21 Jan 2018 07:30:21 +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/617205/1034680#target">Neil Roy</a> said:</div><div class="quote"><p>
n other news, I done some of the Advanced OpenGL - Instancing part of the tutorials and I am blown away at what that can do!!! In this screenshot I am rendering 10000 asteroids which all have 570+ polygons each plus the planet which has over 4000 and getting 91FPS (bottom right corner) without any culling or other optimizations! This is really kewl stuff.
</p></div></div><p>
Hell yeah! That&#39;s what I was saying in one of my previous posts. Modern cards (even 7-10 year old cards!) are unfathomably faster than you think and if they&#39;re slow, it&#39;s 99% of the time you doing something wrong.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Sun, 21 Jan 2018 08:13:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah, my system is actually starting to get a little dated.  My CPU is only a triple core CPU (AMD) and my video is an NVidia GTX650, which isn&#39;t too bad, but also getting dated. </p><p>Still, runs well!  I had 100,000 asteroids being rendered and it did it, was choppy though, around 9-10 FPS, but considering the polygons that were being pushed, something like 57million, that wasn&#39;t too shabby.  With optimizations like proper culling etc... the frame rate could go up pretty dramatically.</p><p>I&#39;m taking the asteroids program and adding on a space skybox with some lighting etc... I want to see what I can make with it. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p>Edit: I also created a simple, cube based 3D City program using older OpenGL programming (immediate or fixed pipeline mode) and I managed to get around 600FPS with culling with it so I have high hopes for this modern stuff.</p><p>Edit2: I have a dropbox link for the older City3D program if you&#39;re curious.<br /><a href="https://www.dropbox.com/s/mfcyhj5q0rdjfd9/City3D.zip?dl=0">https://www.dropbox.com/s/mfcyhj5q0rdjfd9/City3D.zip?dl=0</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Sun, 21 Jan 2018 08:23:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How do you handle looking up and down with a skybox?</p><p>There&#39;s an open game dev exchange question open for you to answer, Neil :</p><p><a href="https://gamedev.stackexchange.com/questions/138173/creating-a-skybox-in-allegro-5">https://gamedev.stackexchange.com/questions/138173/creating-a-skybox-in-allegro-5</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 21 Jan 2018 08:31:59 +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/617205/1034683#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>
How do you handle looking up and down with a skybox?
</p></div></div><p>
It&#39;s just a box with textures on the inside...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Sun, 21 Jan 2018 08:32:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Okay, so what happens when you look at the corners???
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 21 Jan 2018 08:38:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It looks like crap! <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /> <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p>IIRC, you convert the bitmaps to polar coordinates, and then still use a cube.</p><p><a href="http://www.mbsoftworks.sk/index.php?page=tutorials&amp;series=1&amp;tutorial=13">http://www.mbsoftworks.sk/index.php?page=tutorials&amp;series=1&amp;tutorial=13</a></p><p><a href="http://antongerdelan.net/opengl/cubemaps.html">http://antongerdelan.net/opengl/cubemaps.html</a></p><p><div class="media-player youtube"><div style="margin: 1em 2em; background: url(/images/movie.png); width: 180px; height: 100px; text-align: center;"><a href="http://www.allegro.cc//www.youtube.com/watch?v=_Ix5oN8eC1E" target="_blank"><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/object/8/e/8e73c9f104e597ca0296b8c98fee7826.jpg" border="0" alt="video" title="Click to play video" /></a></div></div>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Sun, 21 Jan 2018 08:50:48 +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/617205/1034683#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>How do you handle looking up and down with a skybox?</p></div></div><p>

You rotate the skybox in the opposite direction than you&#39;re looking.  If you look down, so your pitch goes down, the skybox should rotate up.  Note: You do not translate the skybox, it moves with you.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617205/1034685#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>Okay, so what happens when you look at the corners???</p></div></div><p>

You don&#39;t see corners on a skybox.  When you render a skybox, you turn off lighting, you also clamp the edges of the skybox textures so there is no gap or lines where the sides meet (like any model really).  </p><p>My City3D program I linked before this uses a simple skybox I made with old opengl code.  Just a textured cube.  Only I reverse the winding.  OpenGL uses counter clockwise winding for it&#39;s polygons, so for a skybox I switch it to clockwise winding so the front face is on the inside of each side (using the old method of OpenGL anyhow).  Then I disable lighting so there are no shadows on the skybox textures and render it.  I have a function I use I can probably post here that I used in the past (though there are newer ways to do them now, I haven&#39;t studied it yet).</p><p>Important, this uses older, depreciated OpenGL, but it still works.  At the very least, it gives an idea on how to do it which can be converted to modern OpenGL, something I plan to do.  Also, in this function, it uses a global variable which contains the IDs for the various skybox textures that are loaded elsewhere.</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="k1">void</span> skybox<span class="k2">(</span><span class="k1">void</span><span class="k2">)</span>
<span class="number">   2</span><span class="k2">{</span>
<span class="number">   3</span>   <span class="k1">float</span> m_SkyBoxSize <span class="k3">=</span> <span class="k2">(</span><span class="k1">float</span><span class="k2">)</span><span class="k2">(</span>drawmax <span class="k3">*</span> <span class="n">12</span><span class="k2">)</span><span class="k2">;</span> <span class="c">// 200.0f</span>
<span class="number">   4</span>   <span class="k1">float</span> ymin, ymax<span class="k2">;</span>
<span class="number">   5</span>
<span class="number">   6</span>   ymin <span class="k3">=</span> <span class="k3">-</span>m_SkyBoxSize <span class="k3">/</span> <span class="n">2</span>.<span class="n">0f</span><span class="k2">;</span>
<span class="number">   7</span>   ymax <span class="k3">=</span> <span class="n">1</span>.<span class="n">0f</span> <span class="k3">+</span> m_SkyBoxSize <span class="k3">/</span> <span class="n">2</span>.<span class="n">0f</span><span class="k2">;</span>
<span class="number">   8</span>
<span class="number">   9</span>   <span class="c">// Set winding to clock-wise</span>
<span class="number">  10</span>   glFrontFace<span class="k2">(</span>GL_CW<span class="k2">)</span><span class="k2">;</span>
<span class="number">  11</span>
<span class="number">  12</span>   <span class="c">// Front Face</span>
<span class="number">  13</span>   glBindTexture<span class="k2">(</span>GL_TEXTURE_2D, texture<span class="k2">[</span>SKY0<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  14</span>   glTexParameteri<span class="k2">(</span>GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE<span class="k2">)</span><span class="k2">;</span>
<span class="number">  15</span>   glTexParameteri<span class="k2">(</span>GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE<span class="k2">)</span><span class="k2">;</span>
<span class="number">  16</span>   glBegin<span class="k2">(</span>GL_QUADS<span class="k2">)</span><span class="k2">;</span>
<span class="number">  17</span>      glTexCoord2f<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  18</span>      glVertex3f<span class="k2">(</span>m_SkyBoxSize, ymin, m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Bottom Right Of The Texture and Quad</span>
<span class="number">  19</span>      glTexCoord2f<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  20</span>      glVertex3f<span class="k2">(</span>m_SkyBoxSize, ymax, m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Top Right Of The Texture and Quad</span>
<span class="number">  21</span>      glTexCoord2f<span class="k2">(</span><span class="n">0</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  22</span>      glVertex3f<span class="k2">(</span><span class="k3">-</span>m_SkyBoxSize, ymax, m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Top Left Of The Texture and Quad</span>
<span class="number">  23</span>      glTexCoord2f<span class="k2">(</span><span class="n">0</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  24</span>      glVertex3f<span class="k2">(</span><span class="k3">-</span>m_SkyBoxSize, ymin, m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Bottom Left Of The Texture and Quad</span>
<span class="number">  25</span>   glEnd<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  26</span>
<span class="number">  27</span>   <span class="c">// Right face</span>
<span class="number">  28</span>   glBindTexture<span class="k2">(</span>GL_TEXTURE_2D, texture<span class="k2">[</span>SKY1<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  29</span>   glTexParameteri<span class="k2">(</span>GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE<span class="k2">)</span><span class="k2">;</span>
<span class="number">  30</span>   glTexParameteri<span class="k2">(</span>GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE<span class="k2">)</span><span class="k2">;</span>
<span class="number">  31</span>   glBegin<span class="k2">(</span>GL_QUADS<span class="k2">)</span><span class="k2">;</span>
<span class="number">  32</span>      glTexCoord2f<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  33</span>      glVertex3f<span class="k2">(</span>m_SkyBoxSize, ymin, <span class="k3">-</span>m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Bottom Right Of The Texture and Quad</span>
<span class="number">  34</span>      glTexCoord2f<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  35</span>      glVertex3f<span class="k2">(</span>m_SkyBoxSize, ymax, <span class="k3">-</span>m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Top Right Of The Texture and Quad</span>
<span class="number">  36</span>      glTexCoord2f<span class="k2">(</span><span class="n">0</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  37</span>      glVertex3f<span class="k2">(</span>m_SkyBoxSize, ymax, m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Top Left Of The Texture and Quad</span>
<span class="number">  38</span>      glTexCoord2f<span class="k2">(</span><span class="n">0</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  39</span>      glVertex3f<span class="k2">(</span>m_SkyBoxSize, ymin, m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Bottom Left Of The Texture and Quad</span>
<span class="number">  40</span>   glEnd<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  41</span>
<span class="number">  42</span>
<span class="number">  43</span>   <span class="c">// Back Face</span>
<span class="number">  44</span>   glBindTexture<span class="k2">(</span>GL_TEXTURE_2D, texture<span class="k2">[</span>SKY2<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  45</span>   glTexParameteri<span class="k2">(</span>GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE<span class="k2">)</span><span class="k2">;</span>
<span class="number">  46</span>   glTexParameteri<span class="k2">(</span>GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE<span class="k2">)</span><span class="k2">;</span>
<span class="number">  47</span>   glBegin<span class="k2">(</span>GL_QUADS<span class="k2">)</span><span class="k2">;</span>
<span class="number">  48</span>      glTexCoord2f<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  49</span>      glVertex3f<span class="k2">(</span><span class="k3">-</span>m_SkyBoxSize, ymin, <span class="k3">-</span>m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Bottom Right Of The Texture and Quad</span>
<span class="number">  50</span>      glTexCoord2f<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  51</span>      glVertex3f<span class="k2">(</span><span class="k3">-</span>m_SkyBoxSize, ymax, <span class="k3">-</span>m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Top Right Of The Texture and Quad</span>
<span class="number">  52</span>      glTexCoord2f<span class="k2">(</span><span class="n">0</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  53</span>      glVertex3f<span class="k2">(</span>m_SkyBoxSize, ymax, <span class="k3">-</span>m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Top Left Of The Texture and Quad</span>
<span class="number">  54</span>      glTexCoord2f<span class="k2">(</span><span class="n">0</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  55</span>      glVertex3f<span class="k2">(</span>m_SkyBoxSize, ymin, <span class="k3">-</span>m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Bottom Left Of The Texture and Quad</span>
<span class="number">  56</span>   glEnd<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  57</span>
<span class="number">  58</span>   <span class="c">// Left Face</span>
<span class="number">  59</span>   glBindTexture<span class="k2">(</span>GL_TEXTURE_2D, texture<span class="k2">[</span>SKY3<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  60</span>   glTexParameteri<span class="k2">(</span>GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE<span class="k2">)</span><span class="k2">;</span>
<span class="number">  61</span>   glTexParameteri<span class="k2">(</span>GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE<span class="k2">)</span><span class="k2">;</span>
<span class="number">  62</span>   glBegin<span class="k2">(</span>GL_QUADS<span class="k2">)</span><span class="k2">;</span>
<span class="number">  63</span>      glTexCoord2f<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  64</span>      glVertex3f<span class="k2">(</span><span class="k3">-</span>m_SkyBoxSize, ymin, m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Bottom Right Of The Texture and Quad</span>
<span class="number">  65</span>      glTexCoord2f<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  66</span>      glVertex3f<span class="k2">(</span><span class="k3">-</span>m_SkyBoxSize, ymax, m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Top Right Of The Texture and Quad</span>
<span class="number">  67</span>      glTexCoord2f<span class="k2">(</span><span class="n">0</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  68</span>      glVertex3f<span class="k2">(</span><span class="k3">-</span>m_SkyBoxSize, ymax, <span class="k3">-</span>m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Top Left Of The Texture and Quad</span>
<span class="number">  69</span>      glTexCoord2f<span class="k2">(</span><span class="n">0</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  70</span>      glVertex3f<span class="k2">(</span><span class="k3">-</span>m_SkyBoxSize, ymin, <span class="k3">-</span>m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Bottom Left Of The Texture and Quad</span>
<span class="number">  71</span>   glEnd<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  72</span>
<span class="number">  73</span>   <span class="c">// Top Face</span>
<span class="number">  74</span>   glBindTexture<span class="k2">(</span>GL_TEXTURE_2D, texture<span class="k2">[</span>SKY4<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  75</span>   glTexParameteri<span class="k2">(</span>GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE<span class="k2">)</span><span class="k2">;</span>
<span class="number">  76</span>   glTexParameteri<span class="k2">(</span>GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE<span class="k2">)</span><span class="k2">;</span>
<span class="number">  77</span>   glBegin<span class="k2">(</span>GL_QUADS<span class="k2">)</span><span class="k2">;</span>
<span class="number">  78</span>      glTexCoord2f<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  79</span>      glVertex3f<span class="k2">(</span>m_SkyBoxSize, ymax, m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Bottom Right Of The Texture and Quad</span>
<span class="number">  80</span>      glTexCoord2f<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  81</span>      glVertex3f<span class="k2">(</span>m_SkyBoxSize, ymax, <span class="k3">-</span>m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Top Right Of The Texture and Quad</span>
<span class="number">  82</span>      glTexCoord2f<span class="k2">(</span><span class="n">0</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  83</span>      glVertex3f<span class="k2">(</span><span class="k3">-</span>m_SkyBoxSize, ymax, <span class="k3">-</span>m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Top Left Of The Texture and Quad</span>
<span class="number">  84</span>      glTexCoord2f<span class="k2">(</span><span class="n">0</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  85</span>      glVertex3f<span class="k2">(</span><span class="k3">-</span>m_SkyBoxSize, ymax, m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>   <span class="c">// Bottom Left Of The Texture and Quad</span>
<span class="number">  86</span>   glEnd<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  87</span>
<span class="number">  88</span>
<span class="number">  89</span>   <span class="c">// Bottom Face</span>
<span class="number">  90</span>   glBindTexture<span class="k2">(</span>GL_TEXTURE_2D, texture<span class="k2">[</span>SKY5<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  91</span>   glTexParameteri<span class="k2">(</span>GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE<span class="k2">)</span><span class="k2">;</span>
<span class="number">  92</span>   glTexParameteri<span class="k2">(</span>GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE<span class="k2">)</span><span class="k2">;</span>
<span class="number">  93</span>   glBegin<span class="k2">(</span>GL_QUADS<span class="k2">)</span><span class="k2">;</span>
<span class="number">  94</span>      glTexCoord2f<span class="k2">(</span><span class="n">0</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  95</span>      glVertex3f<span class="k2">(</span><span class="k3">-</span>m_SkyBoxSize, ymin, m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>
<span class="number">  96</span>      glTexCoord2f<span class="k2">(</span><span class="n">0</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  97</span>      glVertex3f<span class="k2">(</span><span class="k3">-</span>m_SkyBoxSize, ymin, <span class="k3">-</span>m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>
<span class="number">  98</span>      glTexCoord2f<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  99</span>      glVertex3f<span class="k2">(</span>m_SkyBoxSize, ymin, <span class="k3">-</span>m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 100</span>      glTexCoord2f<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 101</span>      glVertex3f<span class="k2">(</span>m_SkyBoxSize, ymin, m_SkyBoxSize<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 102</span>   glEnd<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 103</span>
<span class="number"> 104</span>   <span class="c">// Set winding to counter clock-wise</span>
<span class="number"> 105</span>   glFrontFace<span class="k2">(</span>GL_CCW<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 106</span>
<span class="number"> 107</span><span class="k2">}</span>
</div></div><p>


Edit: And this is some code I use to draw and rotate the skybox in my City3D program...</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="c">// Draw Skybox</span>
<span class="number">  2</span>   <span class="k1">if</span><span class="k2">(</span>sky_enabled<span class="k2">)</span> <span class="k2">{</span>
<span class="number">  3</span>      glPushMatrix<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  4</span>      glDisable<span class="k2">(</span>GL_LIGHTING<span class="k2">)</span><span class="k2">;</span>                       <span class="c">// disable lighting</span>
<span class="number">  5</span>      glDisable<span class="k2">(</span>GL_DEPTH_TEST<span class="k2">)</span><span class="k2">;</span>                     <span class="c">// disables Depth Testing</span>
<span class="number">  6</span>      glColor3f<span class="k2">(</span><span class="n">1</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>                  <span class="c">// white lighting</span>
<span class="number">  7</span>      glDisable<span class="k2">(</span>GL_FOG<span class="k2">)</span><span class="k2">;</span>                            <span class="c">// no fog</span>
<span class="number">  8</span>      glRotatef<span class="k2">(</span>xrot, <span class="n">1</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>            <span class="c">// rotate around the x axis</span>
<span class="number">  9</span>      glRotatef<span class="k2">(</span>yrot, <span class="n">0</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>            <span class="c">// rotate around the y axis</span>
<span class="number"> 10</span>      glRotatef<span class="k2">(</span>zrot, <span class="n">0</span>.<span class="n">0f</span>, <span class="n">0</span>.<span class="n">0f</span>, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span>            <span class="c">// rotate around the z axis</span>
<span class="number"> 11</span>      skybox<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>                                     <span class="c">// render the skybox</span>
<span class="number"> 12</span>      <span class="k1">if</span><span class="k2">(</span>fog_enabled<span class="k2">)</span> glEnable<span class="k2">(</span>GL_FOG<span class="k2">)</span><span class="k2">;</span>             <span class="c">// turn fog back on</span>
<span class="number"> 13</span>      <span class="k1">else</span> glDisable<span class="k2">(</span>GL_FOG<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 14</span>      glEnable<span class="k2">(</span>GL_LIGHTING<span class="k2">)</span><span class="k2">;</span>                        <span class="c">// turn lighting back on</span>
<span class="number"> 15</span>      glEnable<span class="k2">(</span>GL_DEPTH_TEST<span class="k2">)</span><span class="k2">;</span>                      <span class="c">// Enables Depth Testing</span>
<span class="number"> 16</span>      glPopMatrix<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 17</span>   <span class="k2">}</span>
</div></div><p>

Edit2: Oh, and each side of the skybox should be a 90 degree FOV texture for it to work properly.  90x4 sides = 360 degrees, plus the top and bottom sides.</p><p>Edit3: All this talk about skyboxes, made me add a modern OpenGL Skybox to my space scene, this is what I have now. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p><span class="remote-thumbnail"><span class="json">{"name":"611216","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/4\/54a1053d5d16fcc5fcabc282328a5827.jpg","w":1280,"h":720,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/4\/54a1053d5d16fcc5fcabc282328a5827"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/5/4/54a1053d5d16fcc5fcabc282328a5827-240.jpg" alt="611216" width="240" height="135" /></span></p><p>I want to add in proper lighting and a new planet texture next.  I also thought it would be kewl to add in a couple, random, derilect ships floating around from Star Trek, Star Wars, Apollo etc. <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" /></p><p>Edit4: Created a short video clip of my project so far with music. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /><br /><div class="media-player youtube"><div style="margin: 1em 2em; background: url(/images/movie.png); width: 180px; height: 100px; text-align: center;"><a href="http://www.allegro.cc//www.youtube.com/watch?v=wPAafV7HLjM" target="_blank"><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/object/b/9/b9492dd514c496cb14fa38f7940a3dd4.jpg" border="0" alt="video" title="Click to play video" /></a></div></div>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Sun, 21 Jan 2018 09:32:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That&#39;s pretty sweet, Neil.</p><p>Where did you get your asteroid model?</p><p>I still don&#39;t understand what happens when you look at the corners of the skybox. Shouldn&#39;t the textures be totally distorted?</p><p>Neil, could you show me where you setup your projection matrices for the skybox?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 22 Jan 2018 00:54:25 +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/617205/1034690#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>Where did you get your asteroid model?</p></div></div><p>

I was following the Learn OpenGL tutorials and got the model and information on how to do modern Skyboxes from him.  Though I understood how they work, I just didn&#39;t understand modern techniques, which have improved.  Also see his section on instancing which is where I learned this.  He has a link to this asteroid model, though you can use any model you wish once you get the model loading code down pat.  A direct link to it is here (from his website)...</p><p><a href="https://learnopengl.com/Advanced-OpenGL/data/models/rock.rar">https://learnopengl.com/Advanced-OpenGL/data/models/rock.rar</a></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>I still don&#39;t understand what happens when you look at the corners of the skybox. Shouldn&#39;t the textures be totally distorted?</p></div></div><p>

If you had a normal field of view, they absolutely would be distorted.  But when you create a skybox, you render each view with a 90 degree field of view (as opposed to your normal 45-60 degree FOV most games use).  You have four sides plus the top and bottom.  In order to get a perfect 360 degree panaramic view, you need to have each of the four sides (plus top and bottom) be 360/4=90 degrees.  So once you combine them all, you get what appears to be a panaramic, perfect 360 view you can look around and no corners.  The 90 degree FOV textures actually look a little distorted until you put them on the inside of a cube for the skybox.</p><p>Now if you JUST make a cube with the 90 degree FOV textures, you will see the corners.  You need to turn off lighting which will shade the sides and show shadows in the corners and just light the entire texture evenly by setting a colour as I did as pure white to light up the entire texture.  You also turn off things like fog etc when you render the skybox.  You clamp the edges (see my previous older code which contains code for clamping that is still valid), what that does is it ensure the texture goes all the way to the edge so no seams are visible between textures.</p><p>What you see when you see a corner is shadowing, lighting etc... plus if your textures are views which are less than 90 degree FOV, than you notice it.  Think about it, if you try and fit a 45 degree FOV image onto a side which is a 90 degree FOV, you will get distortion unless the view was 90 degrees ahead of time.</p><p>Also, check out the Java tutorial Chris posted above, it explains modern skyboxes very nicely.  Even though it is Java, it translates over to C/C++ easily.  But the concepts are the same.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Neil, could you show me where you setup your projection matrices for the skybox?</p></div></div><p> </p><p>Learn OpenGL does a great job explaining this and even provides code if you get stuck.  This is the modern method which is more involved, but well worth it.</p><p><a href="https://learnopengl.com/Advanced-OpenGL/Cubemaps">https://learnopengl.com/Advanced-OpenGL/Cubemaps</a></p><p>If you followed along with these tutorials, I basically just needed to insert this code (though I had to alter some of it as he had errors in it, easy fix)...</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>Shader skyboxShader<span class="k2">(</span><span class="s">"6.1.skybox.vs"</span>, <span class="s">"6.1.skybox.fs"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  2</span>
<span class="number">  3</span>  <span class="k1">float</span> skyboxVertices<span class="k2">[</span><span class="k2">]</span> <span class="k3">=</span> <span class="k2">{</span>
<span class="number">  4</span>    <span class="c">// positions          </span>
<span class="number">  5</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number">  6</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number">  7</span>    <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number">  8</span>    <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number">  9</span>    <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 10</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 11</span>
<span class="number"> 12</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 13</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 14</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 15</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 16</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 17</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 18</span>
<span class="number"> 19</span>    <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 20</span>    <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 21</span>    <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 22</span>    <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 23</span>    <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 24</span>    <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 25</span>
<span class="number"> 26</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 27</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 28</span>    <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 29</span>    <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 30</span>    <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 31</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 32</span>
<span class="number"> 33</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 34</span>    <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 35</span>    <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 36</span>    <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 37</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 38</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 39</span>
<span class="number"> 40</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 41</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 42</span>    <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 43</span>    <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 44</span>    <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>,
<span class="number"> 45</span>    <span class="n">1</span>.<span class="n">0f</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0f</span>,  <span class="n">1</span>.<span class="n">0f</span>
<span class="number"> 46</span>  <span class="k2">}</span><span class="k2">;</span>
<span class="number"> 47</span>
<span class="number"> 48</span>  <span class="c">// skybox VAO</span>
<span class="number"> 49</span>  <span class="k1">unsigned</span> <span class="k1">int</span> skyboxVAO, skyboxVBO<span class="k2">;</span>
<span class="number"> 50</span>  glGenVertexArrays<span class="k2">(</span><span class="n">1</span>, <span class="k3">&amp;</span>skyboxVAO<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 51</span>  glGenBuffers<span class="k2">(</span><span class="n">1</span>, <span class="k3">&amp;</span>skyboxVBO<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 52</span>  glBindVertexArray<span class="k2">(</span>skyboxVAO<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 53</span>  glBindBuffer<span class="k2">(</span>GL_ARRAY_BUFFER, skyboxVBO<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 54</span>  glBufferData<span class="k2">(</span>GL_ARRAY_BUFFER, <span class="k1">sizeof</span><span class="k2">(</span>skyboxVertices<span class="k2">)</span>, <span class="k3">&amp;</span>skyboxVertices, GL_STATIC_DRAW<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 55</span>  glEnableVertexAttribArray<span class="k2">(</span><span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 56</span>  glVertexAttribPointer<span class="k2">(</span><span class="n">0</span>, <span class="n">3</span>, GL_FLOAT, GL_FALSE, <span class="n">3</span> <span class="k3">*</span> <span class="k1">sizeof</span><span class="k2">(</span><span class="k1">float</span><span class="k2">)</span>, <span class="k2">(</span><span class="k1">void</span><span class="k3">*</span><span class="k2">)</span><span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 57</span>
<span class="number"> 58</span>  <span class="c">// Skybox Textures</span>
<span class="number"> 59</span>  vector<span class="k3">&lt;</span>std::string&gt; faces
<span class="number"> 60</span>  <span class="k2">{</span>
<span class="number"> 61</span>    <span class="s">"resources/textures/skybox/space_right.jpg"</span>,
<span class="number"> 62</span>    <span class="s">"resources/textures/skybox/space_left.jpg"</span>,
<span class="number"> 63</span>    <span class="s">"resources/textures/skybox/space_top.jpg"</span>,
<span class="number"> 64</span>    <span class="s">"resources/textures/skybox/space_bottom.jpg"</span>,
<span class="number"> 65</span>    <span class="s">"resources/textures/skybox/space_front.jpg"</span>,
<span class="number"> 66</span>    <span class="s">"resources/textures/skybox/space_back.jpg"</span>
<span class="number"> 67</span>  <span class="k2">}</span><span class="k2">;</span>
<span class="number"> 68</span>  <span class="k1">unsigned</span> <span class="k1">int</span> cubemapTexture <span class="k3">=</span> loadCubemap<span class="k2">(</span>faces<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 69</span>
<span class="number"> 70</span>  skyboxShader.use<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 71</span>  skyboxShader.setInt<span class="k2">(</span><span class="s">"skybox"</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
</div></div><p>

I of course created my own space skybox textures and re-organized their loading order as his was flawed.  See his tutorials for other functions mentioned here.</p><p>Now for drawing the skybox, he had some great optimizations.  Normally, using the old OPenGL (see my code again above) you would disable depth testing and draw the skybox first (back to front).  But in this newer code, you actually leave depth testing on and draw the skybox last, which one might think would overwrite the foreground objects, but what you do is adjust settings for the depth testing so that it only draws the parts of the skybox that are visible without overwriting foreground objects.  As a result, this makes it FASTER to render it as you can skip over entire fragments which are not visible.  Kewl beans! <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><div class="source-code snippet"><div class="inner"><pre><span class="c">// draw skybox as last</span>
    glDepthFunc<span class="k2">(</span>GL_LEQUAL<span class="k2">)</span><span class="k2">;</span>  <span class="c">// change depth function so depth test passes when values are equal to depth buffer's content</span>
    skyboxShader.use<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
    view <span class="k3">=</span> glm::mat4<span class="k2">(</span>glm::mat3<span class="k2">(</span>camera.GetViewMatrix<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span> <span class="c">// remove translation from the view matrix</span>
    skyboxShader.setMat4<span class="k2">(</span><span class="s">"view"</span>, view<span class="k2">)</span><span class="k2">;</span>
    skyboxShader.setMat4<span class="k2">(</span><span class="s">"projection"</span>, projection<span class="k2">)</span><span class="k2">;</span>
    <span class="c">// skybox cube</span>
    glBindVertexArray<span class="k2">(</span>skyboxVAO<span class="k2">)</span><span class="k2">;</span>
    glActiveTexture<span class="k2">(</span>GL_TEXTURE0<span class="k2">)</span><span class="k2">;</span>
    glBindTexture<span class="k2">(</span>GL_TEXTURE_CUBE_MAP, cubemapTexture<span class="k2">)</span><span class="k2">;</span>
    glDrawArrays<span class="k2">(</span>GL_TRIANGLES, <span class="n">0</span>, <span class="n">36</span><span class="k2">)</span><span class="k2">;</span>
    glBindVertexArray<span class="k2">(</span><span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
    glDepthFunc<span class="k2">(</span>GL_LESS<span class="k2">)</span><span class="k2">;</span> <span class="c">// set depth function back to default</span>
</pre></div></div><p>

There are separate shader programs you use for the asteroids.  The fragment shaders (which are loaded and compiled when you run the game then sent to the video card).</p><p>Fragment shader for asteroids...
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#version 330 core</span>
out vec4 FragColor<span class="k2">;</span>

in vec2 TexCoords<span class="k2">;</span>

uniform sampler2D texture_diffuse1<span class="k2">;</span>

<span class="k1">void</span> main<span class="k2">(</span><span class="k2">)</span>
<span class="k2">{</span>
    FragColor <span class="k3">=</span> texture<span class="k2">(</span>texture_diffuse1, TexCoords<span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>

Vertex shader for asteroids...
</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="p">#version 330 core</span>
<span class="number">  2</span>layout <span class="k2">(</span>location <span class="k3">=</span> <span class="n">0</span><span class="k2">)</span> in vec3 aPos<span class="k2">;</span>
<span class="number">  3</span>layout <span class="k2">(</span>location <span class="k3">=</span> <span class="n">2</span><span class="k2">)</span> in vec2 aTexCoords<span class="k2">;</span>
<span class="number">  4</span>layout <span class="k2">(</span>location <span class="k3">=</span> <span class="n">3</span><span class="k2">)</span> in mat4 aInstanceMatrix<span class="k2">;</span>
<span class="number">  5</span>
<span class="number">  6</span>out vec2 TexCoords<span class="k2">;</span>
<span class="number">  7</span>
<span class="number">  8</span>uniform mat4 projection<span class="k2">;</span>
<span class="number">  9</span>uniform mat4 view<span class="k2">;</span>
<span class="number"> 10</span>
<span class="number"> 11</span><span class="k1">void</span> main<span class="k2">(</span><span class="k2">)</span>
<span class="number"> 12</span><span class="k2">{</span>
<span class="number"> 13</span>    TexCoords <span class="k3">=</span> aTexCoords<span class="k2">;</span>
<span class="number"> 14</span>    gl_Position <span class="k3">=</span> projection <span class="k3">*</span> view <span class="k3">*</span> aInstanceMatrix <span class="k3">*</span> vec4<span class="k2">(</span>aPos, <span class="n">1</span>.<span class="n">0f</span><span class="k2">)</span><span class="k2">;</span> 
<span class="number"> 15</span><span class="k2">}</span>
</div></div><p>

It really is well worth just following along those tutorials, in order and you will understand all of this.  They&#39;re very well explained, probably the best on the net that I have seen.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Mon, 22 Jan 2018 02:52:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Would you be willing to zip an archive of the source and binaries you used for the asteroids and skybox? I want to play with it. Trying to learn what you did piece by piece isn&#39;t helping me wrap my head around this.</p><p>What I&#39;m trying to get at here, is how do you avoid spherical distortion of the corners of the skybox when you look up and down? I need to see your skybox textures, or see how they were created in order to understand this better.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 22 Jan 2018 06:30:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Okay, I created a trimmed down version with just a skybox and nothing else, in part to make it easier to follow and also to cut down on the filesize.  I also copied the needed libs and includes etc... into one folder and then adjusted the solution properties so it will compile right out of the folder it is all zipped in.  </p><p>This just has a skybox, nothing else.  But all the libs and includes that are needed to do most of the Learn OpenGL tutorials are included so all you would need to do in order to do more is just add in the appropriate code, shaders and resources, which are all easily available from those tutorials.</p><p>This may help anyhow.  The skybox textures are the ones the tutorial author used (except he had the front and back textures mixed up), it should make it easier to understand which direction you&#39;re looking.  It was created using Terragen, you can make your own, just set the field of view to 90 degrees for each compass direction as well as up and down.</p><p>This is a Visual Studio 2017 solution by the way, I don&#39;t know how it will compile with older versions.</p><p><a href="https://www.dropbox.com/s/8apyjnph5nnqeue/Moden%20OpenGL%20-%20Skybox.7z?dl=0">https://www.dropbox.com/s/8apyjnph5nnqeue/Moden%20OpenGL%20-%20Skybox.7z?dl=0</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Mon, 22 Jan 2018 08:25:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Neil, thanks for the download. How many gigabytes does it take to build an msvc project these days? 1.86GB to be precise. Really, you could have just shared the source code and the models plus textures. That would have been good enough.</p><p>I guess you can&#39;t really answer my question. You&#39;re using a cube map from the tutorial, and I guess I just don&#39;t understand what happens when you&#39;re looking at the poles without there being some sort of polar or spherical projection.</p><p>I thought maybe you were doing it with an orthographic transform.</p><p>I don&#39;t really want to mess around with glfw and glew and glut and glad and all that crap. If I can&#39;t do it with straight Allegro and OpenGL I don&#39;t really want to do it. You know, you can get an RGBA* from allegro and create a new texture from that. Or you can use the texture allegro is using.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 22 Jan 2018 19:16:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I posted more than enough tutorials to answer the question. <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Mon, 22 Jan 2018 22:05:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Katko, your links said the exact same thing Neil&#39;s do. Use a cubemap. No. I want to understand what is going on, and how to render it manually. I shouldn&#39;t need a freaking shader to render a background. That&#39;s stupid.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 22 Jan 2018 22:17:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well, this post, which I started, is all about modern opengl.  If you don&#39;t want to use shaders, than you won&#39;t be doing modern opengl.  I felt the same as you at one time, but if you follow the tutorials you will learn that shaders are awesome and actually a lot simpler than I thought.</p><p>The project I shared, you just need to compile it up, you don&#39;t need to know anything about GLFW, it will compile up for you as I already got everything put together for it.</p><p>I don&#39;t plan to use GLFW either, I can&#39;t stand it to be honest, but it is what those tutorials use and is, in the end, not important at all as it is just the framework which creates the window and opengl context, which you can just as easily do with anything else.  I haven&#39;t done it with Allegro myself, so you&#39;re barking up the wrong tree here.  I&#39;ll probably end up switching my entire project to another framework besides GLFW and I&#39;ll switch all the code to C from C++, but the important thing here is to learn modern opengl, everything else is depreciated.</p><p>I already posted OLDer code as well which shows  the older, non-shader way to do it and there isn&#39;t any other way to explain skyboxes.  It&#39;s just a 360 field of view, with four sides, each side is a texture, an image that was photographed or rendered with 90 degree field of view for each side totaling 360.  Forget all the rest of your terminology and projections etc... it&#39;s a lot simpler than that.  It&#39;s exactly what I just said.  Just take four 90 degree views and paste them on the inside of a cube, plus the top and bottom view.  THAT&#39;S IT!!!</p><p>If you want an older game that did it, check out Myst 3, it used a cube/skybox for ALL of it&#39;s stuff.  When you looked around, you were rotating a cube around you, each side animated in that case, but the same thing.  PLus Chris already posted an excellent video on it (I watched it, and more myself, great find Chris!).  There&#39;s nothing more to understand.</p><p>Old OpenGL and non-opengl: create a cube, paste textures on each side that are all created with a 90 degree FOV and you&#39;re done.</p><p>New OpenGL: Use a cubemap, which is basically the same, except newer opengl treats all 6 textures for it like one large texture and then uses a direction vector from the center and your view to determine which fragment to render.</p><p>If you do not like shaders, than you will never use modern OpenGL.  Period.  That is what they are all about, it&#39;s all done via shaders now, you write simple programs for the video card and tell it where to find your variables.  It sounds more complicated than it actually is.  I was VERY resistant to learning it, but I am glad I did as it is not hard at all and you can do some amazing things with them with very little effort.</p><p>I suggest you follow the tutorials using the software they use JUST to learn the OpenGL stuff, then you can get a full understanding of it and be better equipped to apply it to Allegro, perhaps make your own tutorial series once you do for the Allegro community.</p><p>There&#39;s nothing else I can say.  I sat here working on making a self contained project you could easily open and compile right out of the box without setup and you didn&#39;t appreciate it one bit.  </p><p>Edit: as for the asteroid program, if you didn&#39;t like the simple skybox program I packaged up, what would you possibly get out of the rest of a more complex program?  The rest is just loading the planet and asteroid models and displaying them using similar techniques and there is no way in hell I will even try to explain them if you don&#39;t understand skyboxes which are about as simple as one can get.  Again, FOLLOW THE TUTORIALS.  These tutorials are, quite frankly, the best I have ever seen on modern opengl.  They could have used Allegro, or SDL2 or whatever... and it wouldn&#39;t make a lick of difference with regard to opengl, the opengl code is STILL the same, and the methods are STILL the same.  If it was Allegro, you would STILL BE USING THE SAME CODE, and you would be using SHADERS unless you want to use older, depreciated opengl, which still works and is even simpler and I already shared that code above (minus anything Allegro, which honestly, doesn&#39;t matter).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Mon, 22 Jan 2018 22:43:08 +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/617205/1034707#target">Neil Roy</a> said:</div><div class="quote"><p>
If you don&#39;t want to use shaders, than you won&#39;t be doing modern opengl.
</p></div></div><p>
This. Shader&#39;s aren&#39;t that big a deal. They&#39;re just little, concise programs.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Mon, 22 Jan 2018 22:48: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/617205/1034708#target">Chris Katko</a> said:</div><div class="quote"><p>This. Shader&#39;s aren&#39;t that big a deal. They&#39;re just little, concise programs. </p></div></div><p>

Exactly, they&#39;re awesome.  I thought they would be more complicated, and once I learned them I was like... this is amazing!  You basically write simple code on how to treat each fragment it renders, but you can do amazing things with them.</p><p>Heck, most of the shaders look like this...</p><p>Skybox vertex shader:<br />(vertex shaders operate on each vertex sent to it, it is the first stage on the video card)
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#version 330 core</span>
layout <span class="k2">(</span>location <span class="k3">=</span> <span class="n">0</span><span class="k2">)</span> in vec3 aPos<span class="k2">;</span>

out vec3 TexCoords<span class="k2">;</span>

uniform mat4 projection<span class="k2">;</span>
uniform mat4 view<span class="k2">;</span>

<span class="k1">void</span> main<span class="k2">(</span><span class="k2">)</span>
<span class="k2">{</span>
    TexCoords <span class="k3">=</span> aPos<span class="k2">;</span>
    vec4 pos <span class="k3">=</span> projection <span class="k3">*</span> view <span class="k3">*</span> vec4<span class="k2">(</span>aPos, <span class="n">1</span>.<span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
    gl_Position <span class="k3">=</span> pos.xyww<span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>


Skybox fragment shader:<br />The vertex shader passes information to the fragment shader on the video card to process &quot;fragments&quot; or potential pixels, you can do things to each &quot;pixel&quot; (though technically, they are not pixels but for simplicity) creating special effects, anti-aliasing, you name it, quite amazing...
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#version 330 core</span>
out vec4 FragColor<span class="k2">;</span>

in vec3 TexCoords<span class="k2">;</span>

uniform samplerCube skybox<span class="k2">;</span>

<span class="k1">void</span> main<span class="k2">(</span><span class="k2">)</span>
<span class="k2">{</span>    
    FragColor <span class="k3">=</span> texture<span class="k2">(</span>skybox, TexCoords<span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>

All modern OpenGL programs REQUIRE at LEAST a vertex shader and a fragment shader.  There are other shader types as well, but these two are required.  So, either you learn to use shaders, or you use depreciated opengl, fixed pipeline code or stick to 2D.  And if this annoys you, don&#39;t even think about looking into a modern replacement for OpenGL called Vulcan, it&#39;s even worse (I won&#39;t bother with it myself).</p><p>Edit: Let me go over the vertex shader above and maybe I can make it more clear so you are not intimidated by them so much...</p><p><span class="source-code"><span class="p">#version 330 core</span></span><br />^^ This tells the shader which version of opengl we are making it for, in this case, version 3.3.  If you wanted to program some opengl 4.0 stuff, it would be <span class="source-code"><span class="p">#version 400</span></span> perhaps.</p><p><span class="source-code">layout <span class="k2">(</span>location <span class="k3">=</span> <span class="n">0</span><span class="k2">)</span> in vec3 aPos<span class="k2">;</span></span><br />This tells the shader that we will be receiving a position vector, a 3D vector stored in the variable <span class="source-code">aPos</span>, it will have X, Y and Z co-ordinates.</p><p><span class="source-code">out vec3 TexCoords<span class="k2">;</span></span><br />This tells our shader it will be outputting a 3D vector called TexCoords to the fragment shader we will make later, you will notice it takes this as an input in the example I posted above.</p><p><span class="source-code">uniform mat4 projection<span class="k2">;</span></span><br /><span class="source-code">uniform mat4 view<span class="k2">;</span></span><br />Uniforms are like Global variables for shaders.  This tells us we have two of them, a 4D projection matrice and a 4D view matrice.</p><p>Like C/C++, all shaders require a main() function...
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">void</span> main<span class="k2">(</span><span class="k2">)</span>
<span class="k2">{</span>
    TexCoords <span class="k3">=</span> aPos<span class="k2">;</span>
    vec4 pos <span class="k3">=</span> projection <span class="k3">*</span> view <span class="k3">*</span> vec4<span class="k2">(</span>aPos, <span class="n">1</span>.<span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
    gl_Position <span class="k3">=</span> pos.xyww<span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>
...in this case, this main is simple, it applies the position vector we inputted to the TexCoords output vector and sends it along to the fragment shader, doing nothing with it.  Remember, a vertex shader is required, even if it does nothing to this.  This also takes a 4D vector pos variable and calculates the position of the skybox and sets it using a shader variable.</p><p>There&#39;s nothing much to it honestly.  The fragment shader is similar except it sets the colour of a fragment, and you can do things with it, per pixel, this is where some neat special effects are possible (a fragment is a &quot;potential pixel&quot;, it will be converted into screen co-ordinates by your video card later on and become a pixel).</p><p>Edit: Note, this is the GLSL shader language.  Microsoft has their own, similar called HLSL and no doubt Java probably has their own, I don&#39;t know.  They&#39;re all fairly similar.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Mon, 22 Jan 2018 23:05:54 +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/617205/1034707#target">Neil Roy</a> said:</div><div class="quote"><p>
There&#39;s nothing else I can say. I sat here working on making a self contained project you could easily open and compile right out of the box without setup and you didn&#39;t appreciate it one bit. 
</p></div></div><p>
I do appreciate you trying to help me with this, but I do not need 1.86GB of MSVC crap to understand it. I apologize if I wasted your time. I should have asked for less. Less is more sometimes.</p><p>If it was as simple as rendering a cube with textures, there wouldn&#39;t be a special CUBE MAP in OpenGL to do it for you. There must be something going on under the hood.</p><p>Let me try and help you understand my confusion.</p><p>Take for example this skybox texture that I got off the internet. If you look at the colored lines, those have to match exactly or else it will look completely wrong.</p><p><span class="remote-thumbnail"><span class="json">{"name":"611217","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/1\/d1758bcd784ad4f7989425268996385d.png","w":630,"h":480,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/1\/d1758bcd784ad4f7989425268996385d"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/d/1/d1758bcd784ad4f7989425268996385d-240.jpg" alt="611217" width="240" height="182" /></span></p><p>I&#39;ll see if I can come up with my own skybox using an orthographic transform and simple texturing.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 22 Jan 2018 23:45:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah, but what&#39;s the problem you&#39;re trying to solve? They all look like that:</p><p><a href="https://www.google.com/search?q=opengl+cube+map&amp;rlz=1C1CHBD_enUS771US771&amp;source=lnms&amp;tbm=isch&amp;sa=X&amp;ved=0ahUKEwiv3cODl-zYAhVFQ6wKHUBKDdIQ_AUICigB&amp;biw=1000&amp;bih=893">https://www.google.com/search?q=opengl+cube+map&amp;rlz=1C1CHBD_enUS771US771&amp;source=lnms&amp;tbm=isch&amp;sa=X&amp;ved=0ahUKEwiv3cODl-zYAhVFQ6wKHUBKDdIQ_AUICigB&amp;biw=1000&amp;bih=893</a></p><p>Are you trying to figure out how to GENERATE the cubemap texture itself, or RENDER it?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Cube map texturing is a form of texture mapping that uses a 3D direction vector (a fancy phrase that means nothing more than a direction) to index into a texture that is six square 2D textures arranged like the faces of a cube.  
</p></div></div><p>
<a href="http://www.nvidia.com/object/cube_map_ogl_tutorial.html">http://www.nvidia.com/object/cube_map_ogl_tutorial.html</a></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
<b>[You mentioned the seam problem previously]</b>Filtering does not usually take place across cubemap face boundaries. So a visible seam can appear between cubemap face boundaries regardless of the texture filtering modes. Though a setting can permit filtering between faces.
</p></div></div><p>
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Seamless cubemap<br />Seamless Cubemap Filtering<br />Core in version	4.6<br />Core since version	3.2<br />Core ARB extension	ARB_seamless_cube_map<br />Under the standard filtering rules for cubemaps, filtering does not work across faces of the cubemap. This results in a seam across the faces of a cubemap. This was a hardware limitation in the past, but modern hardware is capable of interpolating across a cube face boundary.</p><p>To globally enable this, use glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS).
</p></div></div><p>
<a href="https://www.khronos.org/opengl/wiki/Cubemap_Texture">https://www.khronos.org/opengl/wiki/Cubemap_Texture</a></p><p>(Make sure you have recent drivers if you use that as some people mention failures/artifacts on older cards or very old drivers.)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Tue, 23 Jan 2018 00:19:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>&lt;sigh&gt;</p><p>Well, it IS as simple as making a box with textures, how do I know?  Because I have done it.  I done it with the older fixed pipeline OpenGL (and posted code for it) and I done it with newer OpenGL with shaders, and I posted code for that too!</p><p>The image you posted is simply a collection of all the sides of a box put into one image.  When I load in my images, I load them separately.  You can load each side separately, or you can load in one huge image that you just shown which has all sides on it already, but it is larger because it contains whitespace.  But it is fairly common way to have it all in one image, so it can be handy.</p><p>Download my City3D program and check the images I use for it for my skybox, they are all separate images for each side.  There is nothing special with that huge image you showed, it is just all the sides put together like this...</p><p><span class="remote-thumbnail"><span class="json">{"name":"611218","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/5\/e58f3ee2a567439a9eb499f202a46e25.png","w":700,"h":525,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/5\/e58f3ee2a567439a9eb499f202a46e25"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/e/5/e58f3ee2a567439a9eb499f202a46e25-240.jpg" alt="611218" width="240" height="180" /></span></p><p>AGAIN, for the millionth time, each side is a 90 DEGREE FIELD OF VIEW.  That&#39;s it!!! That&#39;s ALL THE MAGIC!!!  I have done it!  I know what the <span class="cuss"><span>fuck</span></span> I am talking about.</p><p>You can actually put them in any order you wish for a skybox/cubemap, so long as you render them properly etc....</p><p><span class="remote-thumbnail"><span class="json">{"name":"611219","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/8\/78a7eb36bb561f2c3bd39a72389848fc.png","w":534,"h":390,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/8\/78a7eb36bb561f2c3bd39a72389848fc"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/7/8/78a7eb36bb561f2c3bd39a72389848fc-240.jpg" alt="611219" width="240" height="175" /></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Tue, 23 Jan 2018 01:18:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I guess I just don&#39;t understand wtf a 90^ FOV is. Or why it looks so distorted. You can see how the corners of the images for the -X, +Z, +X, -Z directions along the middle of the image stretch up at the corners.</p><p>Take this image for example : <a href="https://orig00.deviantart.net/4ac1/f/2015/365/7/a/4x5negative_panorama123_bc_small_jpeg70_by_nemonameless-d9m8n6c.jpg">4 X 5 Panorama Negative</a></p><p><span class="remote-thumbnail"><span class="json">{"name":"4x5negative_panorama123_bc_small_jpeg70_by_nemonameless-d9m8n6c.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/4\/54b1826c266c95f8d6da0d9dda860ac6.jpg","w":6312,"h":2227,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/4\/54b1826c266c95f8d6da0d9dda860ac6"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/5/4/54b1826c266c95f8d6da0d9dda860ac6-240.jpg" alt="4x5negative_panorama123_bc_small_jpeg70_by_nemonameless-d9m8n6c.jpg" width="240" height="84" /></span></p><p>It&#39;s only got like a 120^ wide FOV and its aspect is 3 to 1. I would have to cram another 150^ into the same image to get one of these skybox textures I&#39;ve been seeing to match the same aspect ratio.</p><p>I understand the concept of a skybox and a cube map. They omit the seventh square (because it is really the same as the back texture rotated 180 degrees.<br /><span class="remote-thumbnail"><span class="json">{"name":"611220","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/4\/04b5b2677530d54e338e03117a08bc44.png","w":800,"h":800,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/4\/04b5b2677530d54e338e03117a08bc44"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/0/4/04b5b2677530d54e338e03117a08bc44-240.jpg" alt="611220" width="240" height="240" /></span></p><p>But if you take a distorted texture, and map it onto a cube, it still looks distorted. Take this annotated image for example :<br /><span class="remote-thumbnail"><span class="json">{"name":"611223","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/3\/a326f6fc7cedda7d5aefb3228409242b.png","w":800,"h":800,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/3\/a326f6fc7cedda7d5aefb3228409242b"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/a/3/a326f6fc7cedda7d5aefb3228409242b-240.jpg" alt="611223" width="240" height="240" /></span></p><p>Each individual image is terribly distorted spherically. Render that distortion onto a cube, and it will still look like crap.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617205/1034713#target">Neil Roy</a> said:</div><div class="quote"><p>
 I <s>done</s> did it with the older fixed pipeline OpenGL (and posted code for it)
</p></div></div><p>
I don&#39;t remember this. Kindly provide a linky for me to clicky on quickly?</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617205/1034711#target">Chris Katko</a> said:</div><div class="quote"><p>
<a href="http://www.nvidia.com/object/cube_map_ogl_tutorial.html">http://www.nvidia.com/object/cube_map_ogl_tutorial.html</a>
</p></div></div><p>
</p><div class="quote_container"><div class="title"><a href="http://www.nvidia.com/object/cube_map_ogl_tutorial.html">http://www.nvidia.com/object/cube_map_ogl_tutorial.html</a> said:</div><div class="quote"><p>
While cube maps are superior to the other approaches described, only <b>state-of-the-art hardware supports cube map textures</b>.  The older sphere map and dual paraboloid methods for environment mapping may still be useful as a fallback when hardware cube map textures are not available.  Cube map textures are more straightforward and efficient, but it good that techniques exist to support older hardware too. <br />...<br />As promised, source code for two sample programs that use the EXT_texture_cube_map extension can be found <a href="http://www.nvidia.com/Marketing/Developer/Images.nsf/Lookup/Cube_map/$file/Cube_map.zip">-here- (broken link)</a>. 
</p></div></div><p>

The 4 x 5 camera I used must not have a very wide FOV. I can&#39;t remember what focal length the lens on it was either.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 23 Jan 2018 04:04:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
While cube maps are superior to the other approaches described, only state-of-the-art hardware supports cube map textures. The older sphere map and dual paraboloid methods for environment mapping may still be useful as a fallback when hardware cube map textures are not available. Cube map textures are more straightforward and efficient, but it good that techniques exist to support older hardware too. 
</p></div></div><p>
That article describes an extension that came out... in 1999.</p><p>It&#39;s been in OpenGL core (not an extension) since 1.3.</p><p><a href="https://www.khronos.org/opengl/wiki/Cubemap_Texture">https://www.khronos.org/opengl/wiki/Cubemap_Texture</a></p><p>Supporting 19 year old hardware would support... at least a few... of your current customers. But what can I say, I only support people who can afford bleeding-edge... 18 year old cards. <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /></p><p>So you&#39;d need a monster GeForce3 with 64MB of RAM, circa 2001, to support cubemaps. And many cards support them as an extension pre-OpenGL 1.3. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p><a href="https://en.wikipedia.org/wiki/List_of_Nvidia_graphics_processing_units#GeForce3_series">https://en.wikipedia.org/wiki/List_of_Nvidia_graphics_processing_units#GeForce3_series</a></p><p>Fun fact: nVidia actually backported OpenGL 2 (shaders) into their older cards like the FX (5xxx) series that originally only supported OpenGL 1.5 (fixed pipeline).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Tue, 23 Jan 2018 04:34:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks for pointing me to a 18 year out of date web page. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p>You didn&#39;t answer any of my questions about the distortion though.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 23 Jan 2018 04:40:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Provide a link to the older code???  SCROLL UP 15 MESSAGES!!!  The code is in the same message I posted my video clip in.  Yeesh.</p><p>There is no distortion, if you do a 90 degree field of view on a square texture.  You know what a FOV is, anyone who has played a video game knows what a FOV is.</p><p>If you use a texture that is not square (duh, it&#39;s a texture), and is not a 90 degree FOV, and you are not at the exact center of the cube (but where else would you be, it&#39;s a skybox), than you will get distortion, period.</p><p>Oh, and if you don&#39;t want to do modern OpenGL, than you need to check out 18 year old pages, because that is how long ago the older OpenGL was used and that is how far back you will need to go to get information on it. (maybe not 18 years, but damn close to it)</p><p>Most of the older tutorials are gradually disappearing or are getting 5+ years old now because everyone is starting to finally switch to modern opengl with shaders.</p><p>To insist on using older, fixed pipeline opengl, is no different than someone else insisting on sticking with Allegro 3 or 4.</p><p>I am though explaining skyboxes any further.  If you can&#39;t wrap your head around them, than don&#39;t even bother with 3D as skyboxes are the simplest things to do other than a straight polygon or normal cube.</p><p>I am seriously starting to think you&#39;re just pulling my chain here.</p><p>As for support, if I can afford a GTX650, which was like $100CDN, so can anyone else.  It supports DX11 and OpenGL 4.3 and they are dirt cheap.  There&#39;s no excuse for not being able to do modern 3D on any computer.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Tue, 23 Jan 2018 07:09:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Side note: Intel HD can even do modern OpenGL and comes included in even the lowest of mobile chipsets.</p><p>My humble ~2013 chromebook with a Celeron and only 2 GB of RAM supports OpenGL 4.5. (Acer C720) And you can get the FOUR GB model for $89. </p><p>I think my last netbook with an old 1st gen Atom CPU still has OpenGL ~3.0.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Tue, 23 Jan 2018 07:29:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah, my wife&#39;s computer was given to her for free (we got two given to us) and it has IntelHD.</p><p>Oh, and that &quot;spherical distortion&quot; Edgar mentions in that cubemap image, is because he is LOOKING AT A FLAT IMAGE!  Of course it is distorted, it hasn&#39;t been mapped to the cube yet!</p><p>Anyhow, I am not buying that Edgar doesn&#39;t understand this.  I think he&#39;s on weed or thinks he&#39;s a joker messing with people.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617205/1034722#target">Chris Katko</a> said:</div><div class="quote"><p>My humble ~2013 chromebook with a Celeron and only 2 GB of RAM supports OpenGL 4.5. (Acer C720) And you can get the FOUR GB model for $89. </p></div></div><p>

My system is from like... 2011 or so?  Losing track now. <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=";D" border="0" />  Actually thinking about building a new system this year.</p><p>Edgar, this is why you are confused...</p><p>Wants to know modern OpenGL...
</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617205/1034679#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>How do you render a quad in modern OpenGL? </p></div></div><p>

Wants my MSVC source at 1.86G...
</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617205/1034700#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>How many gigabytes does it take to build an msvc project these days? 1.86GB to be precise. Really, you could have just shared the source code and the models plus textures. That would have been good enough.</p></div></div><p>
 <br />Doesn&#39;t want my 1.86 MSVC crap...
</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617205/1034710#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>I do not need 1.86GB of MSVC crap to understand it</p></div></div><p>

Doesn&#39;t want to learn modern OpenGL...
</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617205/1034706#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>Katko, your links said the exact same thing Neil&#39;s do. Use a cubemap. No. I want to understand what is going on, and how to render it manually. I shouldn&#39;t need a freaking shader to render a background. That&#39;s stupid. </p></div></div><p>
</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617205/1034700#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>I don&#39;t really want to mess around with glfw and glew and glut and glad and all that crap. If I can&#39;t do it with straight Allegro and OpenGL I don&#39;t really want to do it.</p></div></div><p>

Incidentally, you really do need GLEW or GLAD if you want to do modern OpenGL as they greatly simplify handling all the OpenGL extensions, which is all they are for.  But then, you don&#39;t want to learn Modern OpenGL... or rather... you do... or... &lt;confused&gt;</p><p><img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Tue, 23 Jan 2018 07:30:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The only other thing I can think is maybe Edgar&#39;s got the wrong texture WRAPPING/clamping mode set? </p><p>Ala example here, which should be enough code for him to use:</p><p><a href="https://www.opengl.org/discussion_boards/showthread.php/170050-Cube-Mapping-Using-OpenGL">https://www.opengl.org/discussion_boards/showthread.php/170050-Cube-Mapping-Using-OpenGL</a></p><p>[edit] Well, maybe it&#39;s not the perfect example thread, but it shows the wrap calls.</p><p>[edit] WOW, I was poking around my OpenGL supported extensions and found this gem:</p><p><a>https://github.com/KhronosGroup/OpenGL-Registry/blob/master/extensions/INTEL/INTEL_performance_query.txt</a></p><p>Tons of hardware performance counters for debugging/profiling. I know their CPUs have tons of that stuff too. But it&#39;s neat to know you can get statistics on number of shader calls, etc--even if it&#39;s on a piece-of-crap integrated intel graphics card.</p><p>It may come in handy later to tweak my games for low end systems.</p><p>[edit] Okay, so nVidia (and AMD) also have Perf kits!</p><p><a href="https://developer.nvidia.com/nvidia-perfkit">https://developer.nvidia.com/nvidia-perfkit</a></p><p>Of course it only runs on Windows... because nVidia is a bunch of @!#$!&#39;s.</p><p>Meanwhile, AMD&#39;s does.</p><p><a href="https://developer.amd.com/gpuperfapi/">https://developer.amd.com/gpuperfapi/</a></p><p>And not only that, they&#39;re OPEN SOURCE:</p><p><a href="https://gpuopen.com/gaming-product/gpuperfapi/">https://gpuopen.com/gaming-product/gpuperfapi/</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Tue, 23 Jan 2018 08:03:51 +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/617205/1034726#target">Chris Katko</a> said:</div><div class="quote"><p>The only other thing I can think is maybe Edgar&#39;s got the wrong texture WRAPPING/clamping mode set? </p></div></div><p>

Nah, he&#39;s looking at the flat cube map and wondering about the distortions at the corners.  Well, they&#39;re distorted for good reason, because he&#39;s looking at them all flattened out instead of from the inside of a cube with them on the sides. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />  Once it is inside a cube, there are no distortions because... ah, forget it.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Tons of hardware performance counters for debugging/profiling. </p></div></div><p>

There&#39;s where things like GLEW (open GL Extension Wrangler) and GLAD help (both do the same thing, take your pick).  They figure out which extensions your card can use and then set all that up for you so you don&#39;t have to worry about it.  You just... use OpenGL.  They&#39;re really quite handy and pretty much all tutorials on the subject of OpenGL will mention using one of them (usually GLEW as it has been around longer).</p><p>BUT, you don&#39;t NEED them, you can do OpenGL with Allegro without GLEW or GLAD or anything else.  You&#39;ll just have to handle any extension issues yourself, and there were a lot of new functionality added to OpenGL and some different video cards use differently named functions, which is why GLEW and GLAD are so great, you don&#39;t have to worry about that, and if you&#39;re going to give out your program, you better make certain it can handle different commands on different cards.  Have fun with that without something like GLEW or GLAD! <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>But just for straight, old opengl, you could do without it.  Good for learning I guess.</p><p><s>Maybe I&#39;ll sit down and make a simple Skybox with OpenGL and Allegro, but I really don&#39;t want to do much with Allegro anymore.</s> Edit: changed my mind, I&#39;ll pass on Allegro coding.  I&#39;ll leave the OpenGL + Allegro stuff with Edgar (<a href="https://www.allegro.cc/forums/thread/617199">https://www.allegro.cc/forums/thread/617199</a>). I want to switch to SDL2, but that&#39;s another subject.  It really doesn&#39;t matter which you use as Allegro and SDL2 and GLFW are all just interfaces to set up a window and opengl context. </p><p>The tutorial I linked to at the start of this just happens to use GLFW, which I am using just so I can concentrate on learning the newer OpenGL instead of figuring out how to get it all working with Allegro or SDL2.  I&#39;m even doing C++ coding which I can&#39;t stand! But I plan to convert my personal 3D project to SDL2 &amp; pure C.  I also want to convert my projects to Code::Blocks/MinGW as I am not a fan of the convoluted crap that is MSVC! <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p>My City3D program is coded using Code::Blocks and NO other libs, not Allegro, not SDL2... just plain old Win32 stuff, OpenGL and pure C code.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Tue, 23 Jan 2018 08:44:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m in the middle of a long post and Windoze decides to pull it&#39;s forceful shutdown and update mode on me. It&#39;s been working for half an hour and it&#39;s only 25% done. Lame. ;P It&#39;s holding my computer hostage.</p><p>I&#39;m coding a skybox from scratch with allegro and &quot;old&quot; OpenGL. If it&#39;s really as simple as rendering a cube, I&#39;ll <span class="cuss"><span><span class="cuss"><span>shit</span></span></span></span> myself.</p><p>May take me a while though. Sigh.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 23 Jan 2018 15:25:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Here, you may need this. <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /><br /><span class="remote-thumbnail"><span class="json">{"name":"611227","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/3\/b3133f60c7391cbac02cd8c1ddc1a601.jpg","w":2200,"h":2017,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/3\/b3133f60c7391cbac02cd8c1ddc1a601"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/b/3/b3133f60c7391cbac02cd8c1ddc1a601-240.jpg" alt="611227" width="240" height="220" /></span></p><p>It really is just that simple.  Let me try and explain again. The key things to remember is;</p><p>1) Make a square cube.  Obviously.<br />2) Texture each side with an image that was rendered with a 90 degree field of view.  If you ever played a video game, your FOV is usually 45 - 65 degrees, and you can often adjust it.  at 90 degrees you see a much wider area and it seems distorted.  When you look at a cube map, as you did, it looks distorted, but that is because you&#39;re looking at a flat image.  Remember, those maps, usually a cross shaped map, is simple an unfolded cube.  Once you fold it up back into a cube, those distorted corners will look normal and no longer distorted from inside the cube.<br />3) Make certain your point of view is in the exact center of it, or you will notice distortions.<br />4) Make certain you have NO lighting on the cube.  Usually I just pick a colour, like pure white for the sides, it will lighten up the textures without applying any shadows to the corners etc.<br />5) Make sure you clamp the textures, but then you would do this normally for all 3D models and such so you don&#39;t see seams.<br />6) Turn off anything else that can effect the cube, like fog and depth testing.</p><p>In older opengl you draw the skybox first, depth testing disabled, then once it is drawn, you can turn it back on along with lighting and such.</p><p>The view from the inside of the cube will appear normal, no distortions etc.  The total view around you is 360 degrees, each side is a 90 degree portion of that view.  YOU won&#39;t be looking at the entire side though once you are viewing it, only part of it, depending on your own field of view you set, most people set it to 45, I like 60 degrees.  So, no distortion.  You rotate the cube around you, but do not translate it and it will work out fine.</p><p>I seen your Allegro OpenGL code and it looked great!  You made a cube, just need to make it bigger maybe, and put yourself in the center of it with the textures.</p><p>Oh, and if you want to make your own skybox renders, try and hunt down an older copy of Teragen, it was free (version 0.9.43).  It limits the size you can render to, unregistered (can&#39;t register it either, too old), but you can render 512x512 sized textures which are fine for skyboxes.  Set the ZOOM factor to 1 even, that will be 90 degrees, then you create a landscape, set your heading to 0 etc.. all to zero so you are looking straight north and render, that will be your FRONT texture, then, while looking north (important) you set your pitch to -90 (straight up) and render again, that will be UP.  Then set the pitch to +90, straight down, render again, DOWN view.  Then set your pitch to zero and your heading to -90, that will be your left view, +90 heading is right view, +180 heading is back view.  Presto, you&#39;re done.</p><p>For making them as photographs it is more difficult because you need that 90 degree FOV, but there are tutorials online that show you how, and probably the right camera.  I just have never bothered, I can render what I need just fine, or find stuff via Google.</p><p>This is one I made last night just for fun... called Mars...<br /><span class="remote-thumbnail"><span class="json">{"name":"611228","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/a\/7a572cd506f72b05c9cf2c2b7b63077d.png","w":2048,"h":1536,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/a\/7a572cd506f72b05c9cf2c2b7b63077d"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/7/a/7a572cd506f72b05c9cf2c2b7b63077d-240.jpg" alt="611228" width="240" height="180" /></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Wed, 24 Jan 2018 01:40:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Btw. Allegro comes with an example that displays a skybox: <a href="https://github.com/liballeg/allegro5/blob/master/examples/ex_camera.c">https://github.com/liballeg/allegro5/blob/master/examples/ex_camera.c</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 24 Jan 2018 02:04: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/617205/1034755#target">Neil Roy</a> said:</div><div class="quote"><p>
Here, you may need this.
</p></div></div><p>
I always knew you rolled your toilet paper upside down. Blasphemy!</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617205/1034756#target">Elias</a> said:</div><div class="quote"><p>
an example that displays a skybox
</p></div></div><p>
<span class="remote-thumbnail"><span class="json">{"name":"611229","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/e\/9e5bed09f24e3dc30de79ffc7a979c06.png","w":642,"h":401,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/e\/9e5bed09f24e3dc30de79ffc7a979c06"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/9/e/9e5bed09f24e3dc30de79ffc7a979c06-240.jpg" alt="611229" width="240" height="149" /></span><br />Nice corner. :/</p><p>Still working on my example. Will report back.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 24 Jan 2018 05:42:51 +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/617205/1034767#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>  I always knew you rolled your toilet paper upside down. Blasphemy!</p></div></div><p>Here, here!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bamccaig)</author>
		<pubDate>Wed, 24 Jan 2018 05:51:56 +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/617205/1034767#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>I always knew you rolled your toilet paper upside down. Blasphemy!</p></div></div><p>

Actually, mine is hung properly, only not on a normal roll, but I have a hanger I bent so that I can hang in from a towel rack and not have to become a contortionist to use it! <img src="http://www.allegro.cc/forums/smileys/cool.gif" alt="8-)" /></p><p><span class="remote-thumbnail"><span class="json">{"name":"611230","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/8\/888f58fb9b21db36c295f6fa228cc9ff.jpg","w":512,"h":695,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/8\/888f58fb9b21db36c295f6fa228cc9ff"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/8/8/888f58fb9b21db36c295f6fa228cc9ff-240.jpg" alt="611230" width="240" height="325" /></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Wed, 24 Jan 2018 10:43:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Some things are the same in every part of the world. <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /><br />I wonder what they use in the amazon forrest
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ariesnl)</author>
		<pubDate>Wed, 24 Jan 2018 13:38:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I imagine they use something involving The Cloud.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Wed, 24 Jan 2018 21:09:24 +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/617205/1034777#target">Ariesnl</a> said:</div><div class="quote"><p>I wonder what they use in the amazon forrest </p></div></div><p>

Probably small furry creatures. <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Thu, 25 Jan 2018 03:35:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>My skybox is seriously messed up.</p><p>EDIT<br /><span class="remote-thumbnail"><span class="json">{"name":"611235","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/7\/170e1bca67919e58d6529e9187c92fa2.png","w":802,"h":633,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/7\/170e1bca67919e58d6529e9187c92fa2"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/1/7/170e1bca67919e58d6529e9187c92fa2-240.jpg" alt="611235" width="240" height="189" /></span><br /><span class="remote-thumbnail"><span class="json">{"name":"611236","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/c\/dc131e5187f62ae06b579cf24812e71a.png","w":802,"h":633,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/c\/dc131e5187f62ae06b579cf24812e71a"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/d/c/dc131e5187f62ae06b579cf24812e71a-240.jpg" alt="611236" width="240" height="189" /></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 27 Jan 2018 00:15:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s a feature!</p><p>You&#39;re just holding the monitor wrong.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Sat, 27 Jan 2018 02:42:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I tried to do it with just one texture but my tex coords must be off. I&#39;m also drawing the cube with two triangle fans, because two opposing vertices touch all the other faces. Gonna take a look at your City3D program a little later for some hints. I still don&#39;t think it&#39;s going to look right.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 27 Jan 2018 06:43:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Looks like you&#39;re using an orthographic view instead of a perspective one.</p><p>Here&#39;s the complete source code with Code::Blocks project for my City3D.  It&#39;s a project I have been messing around with since 2004.  It includes a separate Allegro 4 project for the map editor (already compiled), it&#39;s just a 2D editor that saves to the same map name each time.  If you&#39;re curious about other maps, just rename them to city.map and the program will load them.</p><p>The main program doesn&#39;t use Allegro, it doesn&#39;t use anything (except the freeimage library, though I have separate code to load uncompressed TGAs which can be used instead).  This is a Windows (IE: WinMain()) project, no allegro, no sdl2, nothing.  It was something I started in order to learn a little straight Windows coding.  The OpenGL stuff is pretty straight forward, if you can handle my coding style and C only code. </p><p>Oh, and I changed my code to use all QUADS, no triangles, though they could be used, I tried to keep it as simple as possible to make learning OpenGL easier, which is why I also stuck to a grid layout and cubes at the time (before Minecraft! heh).</p><p>I added in keys (listed on the main screen when you run it) to show wireframe mode, so you can see what is drawn.  TO enable/disable Vsync, to enable/disable fullscreen mode, disable the onscreen text (except the FPS) which can speed things up a tad.  SHIFT key goes super fast, use E and Q to fly up in the air (better when zipping around the map).  Frustum culling can be toggled, note, my frustum culling is simple, and only culls to the right and left, but doesn&#39;t take into account your angle looking up and down (because this was meant to be only driving, no flying and looking up and down). You can toggle the skybox on and off as well etc... the code may help.  Maybe try converting this to use Allegro as the main framework?  I plan to convert this to modern opengl, should be interesting to see the FPS difference.</p><p><a href="https://www.dropbox.com/s/r4bea14ll60vcz9/City3D_source.7z?dl=0">https://www.dropbox.com/s/r4bea14ll60vcz9/City3D_source.7z?dl=0</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Sat, 27 Jan 2018 08:28:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Been up all night and the coffee house network has banned Dropbox, so I&#39;ll get it a little later. Need some zzzzs.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 28 Jan 2018 03:12:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hah, I stayed up all night too. I feel like <span class="cuss"><span><span class="cuss"><span>shit</span></span></span></span> today though. <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" /></p><p><b>Append:</b></p><p>I guess this wasn&#39;t the O/T thread... Whoops.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bamccaig)</author>
		<pubDate>Sun, 28 Jan 2018 08:26:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I don&#39;t know what I&#39;m doing wrong. My cube coordinates look right, and so do my texture coordinates.</p><p><span class="remote-thumbnail"><span class="json">{"name":"611241","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/6\/d6d68a2224a1ecd4d3cb22580ea3a32b.png","w":1365,"h":847,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/6\/d6d68a2224a1ecd4d3cb22580ea3a32b"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/d/6/d6d68a2224a1ecd4d3cb22580ea3a32b-240.jpg" alt="611241" width="240" height="148" /></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 29 Jan 2018 21:43:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think it would be nice adding an actual texture to the ex_camera skybox - maybe I&#39;ll do that tonight. The skybox code in there originally is from a textured version so I can just copy&amp;paste it back in and I&#39;ll add a command-line paramater to specify a picture with the skybox.</p><p>Otherwise, from your screenshot it definitely looks like some of the UV coordinates are off. Also - are you sure your camera is <b>inside</b> of your box? It won&#39;t work if you look at it from the outside.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Mon, 29 Jan 2018 22:56:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That screenshot is with an orthographic projection, so I can see the cube, because for some reason it doesn&#39;t show up when I use a perspective projection. I&#39;ll put my code up on GitHub. <a href="https://github.com/EdgarReynaldo/Skybox">https://github.com/EdgarReynaldo/Skybox</a></p><p>EDIT<br />I enabled GL_CULL_FACE, I set the front face to GL_CCW, and I set it to cull backfaces, but I see the outside of my skybox. What gives? I know I wound the vertices in CCW order.</p><p>EDIT2<br />My skybox and my cube are both inside out, but I don&#39;t know why.</p><p>EDIT3<br />I think it has something to do with the handedness of OpenGL. My vertices are wound perfectly counterclockwise, but when I print them out, they are wound in clockwise order? WTF?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 29 Jan 2018 23:07:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You&#39;re using Orthographic projection.  That is not 3D and will never work.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Tue, 30 Jan 2018 03:18:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Here is an updated ex_camera: <a href="https://github.com/liballeg/allegro5/compare/master...allefant:skybox">https://github.com/liballeg/allegro5/compare/master...allefant:skybox</a></p><p>I called it like this: ./ex_camera /tmp/skybox.png</p><p>And it looks like this:</p><p>There is some white border around the top face but I think that&#39;s because of Neil&#39;s source picture, adding a few pixels where he has white there likely would fix it!</p><p><span class="remote-thumbnail"><span class="json">{"name":"611244","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/9\/496cc9b40906b13bfa6cceed84e840f8.png","w":1140,"h":739,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/9\/496cc9b40906b13bfa6cceed84e840f8"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/4/9/496cc9b40906b13bfa6cceed84e840f8-240.jpg" alt="611244" width="240" height="155" /></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Tue, 30 Jan 2018 08:54:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I never did test that image.  Is it edge clamped?  I attached the original separate images in a 7z to this message if you want to work with them, to redo that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Tue, 30 Jan 2018 22:27:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ha, no, I just used the picture you posted and set the U/V coordinates to 0.25/0.33 - so they simply include the white pixels. Only hacked it in in half an hour or so. Just wanted to confirm that indeed all you do is paste a texture on the inside of an unlit untranslated cube - and ex_camera already was doing everything (except apply a texture).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Tue, 30 Jan 2018 22:59:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ah, okay.  Yeah, it is much simpler than some realize.  A sort of optical illusion.  The concept is simple enough.  If you want a 360 degree view all around you, and you have four sides all the same size, than you make each view 360/4 degrees, or a 90 degree field of view.</p><p>Terragen is handy for that, it&#39;s what I used.  It doesn&#39;t have degrees (the old version anyhow), but the ZOOM factor when set to 1 even, equals 90 degree field of view.  After that, just render each direction to a 512x512 texture and you&#39;re all set.</p><p>Anyhow, the original pics are in that zip if anyone wants them separate.  I only done it in that single cross shape because that is the most common I find online.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Wed, 31 Jan 2018 01:48:41 +0000</pubDate>
	</item>
</rss>
