<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Setting up Modern OpenGL with allegro 5</title>
		<link>http://www.allegro.cc/forums/view/617668</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 22 Dec 2018 17:34:32 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>hello,<br />I&#39;m trying to follow this tutorial <a href="https://learnopengl.com/Getting-started/Hello-Triangle">https://learnopengl.com/Getting-started/Hello-Triangle</a></p><p>With allegro 5 as a framework. I did include #include &lt;allegro5/allegro_opengl.h&gt;<br />but still a lot of openGL stuff is not found</p><p>||=== Build: Release in OpenGL_Demo (compiler: GNU GCC Compiler) ===|<br />D:\Development\Code\OpenGL_Alleg\CustomProgram.cpp||In constructor &#39;CustomProgram::CustomProgram(int, int, bool)&#39;:|<br />D:\Development\Code\OpenGL_Alleg\CustomProgram.cpp|50|error: &#39;glGenBuffers&#39; was not declared in this scope|<br />D:\Development\Code\OpenGL_Alleg\CustomProgram.cpp|51|error: &#39;GL_ARRAY_BUFFER&#39; was not declared in this scope|<br />D:\Development\Code\OpenGL_Alleg\CustomProgram.cpp|51|error: &#39;glBindBuffer&#39; was not declared in this scope|<br />D:\Development\Code\OpenGL_Alleg\CustomProgram.cpp|52|error: &#39;GL_STATIC_DRAW&#39; was not declared in this scope|<br />D:\Development\Code\OpenGL_Alleg\CustomProgram.cpp|52|error: &#39;glBufferData&#39; was not declared in this scope|<br />D:\Development\Code\OpenGL_Alleg\A5Program.cpp||In constructor &#39;A5Program::A5Program(int, int, bool, bool)&#39;:|<br />D:\Development\Code\OpenGL_Alleg\A5Program.cpp|96|warning: unused variable &#39;m_nWidth&#39; [-Wunused-variable]|<br />D:\Development\Code\OpenGL_Alleg\A5Program.cpp|97|warning: unused variable &#39;m_nHeight&#39; [-Wunused-variable]|<br />||=== Build finished: 5 error(s), 2 warning(s) (0 minute(s), 0 second(s)) ===|</p><p>Any tips on how to set it up  correctly &gt;<br />I attached my project so you can see what I&#39;m trying to do
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ariesnl)</author>
		<pubDate>Tue, 18 Dec 2018 14:00:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Windows OpenGL headers only expose 1.1. To get extensions, you need to use something custom like GLEW, or <a href="https://liballeg.org/a5docs/trunk/opengl.html#al_get_opengl_proc_address">al_get_opengl_proc_address</a>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 19 Dec 2018 06:22:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I tought Allegro would already take care of that, since it uses OpenGL itself...</p><p>Annyway  what would be the easiest way to do it ?<br />I tried to compile with glew once bu I gave up after getting a lot of undefined references  <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ariesnl)</author>
		<pubDate>Wed, 19 Dec 2018 13:27:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Undefined references are caused by not linking to the correct libraries. If you want to be a good programmer, you&#39;re going to have to learn how to link properly. Link or swim.</p><p>Extensions are not defined because they&#39;re extensions. Read the manual link I posted that tells you exactly how to define an extension pointer and call it.</p><p><a href="https://www.opengl.org/discussion_boards/showthread.php/172481-glGenBuffer-was-not-declared">https://www.opengl.org/discussion_boards/showthread.php/172481-glGenBuffer-was-not-declared</a></p><p>Your project wasn&#39;t linking opengl so even if it compiled, it would still give undefined references. -lglu32 -lopengl32
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 19 Dec 2018 16:31:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Allegro already loads all the extensions (i.e. it does the same thing GLEW does already). If some newer extension is missing from Allegro we should add it. It also might make sense to replace Allegro&#39;s extension code with GLEW (as a new dependency for Allegro) since they are probably doing a better job. (If we can do so without breaking old Allegro code at least.)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Thu, 20 Dec 2018 22:17:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I discovered something with gdb today. If you do &#39;info variables&#39;, it will print out EVERY variable in existence. That means every single global defined in any file anywhere.</p><p>If you do &#39;info variables glGenBuffer&#39; inside gdb while running an allegro program, you get this back :</p><pre>
(gdb) info variables glGenBuffer
All variables matching regular expression &quot;glGenBuffer&quot;:

File E:/LIBS/LIBS81Build/allegro5/include/allegro5/opengl/GLext/gl_ext_api.h:
_ALLEGRO_glGenBuffers_t _al_glGenBuffers;
_ALLEGRO_glGenBuffersARB_t _al_glGenBuffersARB;
(gdb)
</pre><p>

So allegro 5 knows about glGenBuffer, it&#39;s just hiding it from you.</p><div class="quote_container"><div class="title">The Manual said:</div><div class="quote"><p>
al_get_opengl_proc_address<br />void *al_get_opengl_proc_address(const char *name)<br />Source Code</p><p>Helper to get the address of an OpenGL symbol</p><p>Example:</p><p>How to get the function glMultiTexCoord3fARB that comes with ARB&#39;s Multitexture extension:</p><p>// define the type of the function<br />ALLEGRO_DEFINE_PROC_TYPE(void, MULTI_TEX_FUNC,<br />                         (GLenum, GLfloat, GLfloat, GLfloat));<br />// declare the function pointer<br />MULTI_TEX_FUNC glMultiTexCoord3fARB;<br />// get the address of the function<br />glMultiTexCoord3fARB = (MULTI_TEX_FUNC) al_get_opengl_proc_address(<br />                                                        &quot;glMultiTexCoord3fARB&quot;);<br />If glMultiTexCoord3fARB is not NULL then it can be used as if it has been defined in the OpenGL core library.</p><p>Note: Under Windows, OpenGL functions may need a special calling convention, so it&#39;s best to always use the ALLEGRO_DEFINE_PROC_TYPE macro when declaring function pointer types for OpenGL functions.</p><p>Parameters:</p><p>name - The name of the symbol you want to link to.</p><p>Return value:</p><p>A pointer to the symbol if available or NULL otherwise.
</p></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 22 Dec 2018 17:34:32 +0000</pubDate>
	</item>
</rss>
