<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>AL5 + OpenGL - al_draw_text not working?</title>
		<link>http://www.allegro.cc/forums/view/612156</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 08 Mar 2013 10:35:35 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Firstly: I&#39;m confused about al_set_current_opengl_context() and what its purpose is.  I&#39;m not sure what the documentation is trying to say about it - its very vague saying that I &quot;might need it&quot; but gives no indication as to why, or when not to use it, etc...</p><p>Secondly: if I specifically set a target bitmap, will OpenGL not render to that bitmap?</p><p>I don&#39;t know where my target bitmap is when I&#39;m rendering with OpenGL without setting a target, although when I flip_display it works fine - everything renders as expected.  But when I use al_draw_text, regardless if I set_target_bitmap to backbuffer or not, it doesnt show up.  I&#39;m accustomed to simply setting target bitmap to display backbuffer but the al_set_current_opengl_context() manual entry has me confused about whether or not this is even available when using OpenGL?</p><p>I thought this may just be an issue with the projection matrix, so I disabled all of that but it still doesn&#39;t display anything...</p><p>I&#39;m sure its another bonehead misunderstanding on my part...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (thebignic)</author>
		<pubDate>Tue, 05 Mar 2013 20:40:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi I&#39;m also new to AL5+OpenGL but got that &quot;al_draw_text&quot; problem solved last day:</p><p>To draw 2D stuff you must first configure both matrix.
</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">//at initialization code:</span>
<span class="number">  2</span>    <span class="k1">int</span> resX<span class="k3">=</span><span class="n">640</span>, resY<span class="k3">=</span><span class="n">480</span><span class="k2">;</span>
<span class="number">  3</span>    <a href="http://www.allegro.cc/manual/ALLEGRO_FONT"><span class="a">ALLEGRO_FONT</span></a><span class="k3">*</span> arialFont<span class="k3">=</span><a href="http://www.allegro.cc/manual/al_load_ttf_font"><span class="a">al_load_ttf_font</span></a><span class="k2">(</span><span class="s">"arial.ttf"</span>, <span class="n">18</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span><span class="c">//copy arial.ttf or whatever to your exe folder</span>
<span class="number">  4</span>
<span class="number">  5</span>    <span class="c">//at drawing routine:</span>
<span class="number">  6</span>    <span class="c">//configure matrix to draw 2D STUFF</span>
<span class="number">  7</span>    glMatrixMode<span class="k2">(</span>GL_PROJECTION<span class="k2">)</span><span class="k2">;</span>
<span class="number">  8</span>    glLoadIdentity<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  9</span>    glOrtho<span class="k2">(</span><span class="n">0</span>.<span class="n">0</span>, resX, resY, <span class="n">0</span>.<span class="n">0</span>, <span class="k3">-</span><span class="n">1</span>.<span class="n">0</span>, <span class="n">10</span>.<span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 10</span>    glMatrixMode<span class="k2">(</span>GL_MODELVIEW<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 11</span>    glLoadIdentity<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 12</span>    glDisable<span class="k2">(</span>GL_CULL_FACE<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 13</span>           
<span class="number"> 14</span>    <a href="http://www.allegro.cc/manual/al_draw_text"><span class="a">al_draw_text</span></a><span class="k2">(</span>arialFont,<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">44</span>, <span class="n">117</span>, <span class="n">250</span> <span class="k2">)</span>, <span class="n">50</span>, <span class="n">50</span>, ALLEGRO_ALIGN_LEFT,<span class="s">"my text out"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 15</span>
<span class="number"> 16</span>    <a href="http://www.allegro.cc/manual/al_wait_for_vsync"><span class="a">al_wait_for_vsync</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 17</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"> 18</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"> 19</span>    <span class="c">//....</span>
</div></div><p>

About the other issue you talk about... I can&#39;t help you sorry.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (joecarl)</author>
		<pubDate>Fri, 08 Mar 2013 09:43:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><span class="source-code"><a href="http://www.allegro.cc/manual/al_set_current_opengl_context"><span class="a">al_set_current_opengl_context</span></a></span> is only necessary if you create multiple OpenGL contexts, where one or more of them is &quot;forward compatible,&quot; and need to switch between them. This means using OpenGL 3 or greater.</p><p>So, are you using an OpenGL 3 forward compatible context? E.g., do you pass <span class="source-code">ALLEGRO_OPENGL_3_0</span> to <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>, and if so, do you also pass <span class="source-code">ALLEGRO_OPENGL_FORWARD_COMPATIBLE</span>? If the answer is no, then do not worry about that method.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Erin Maus)</author>
		<pubDate>Fri, 08 Mar 2013 10:35:35 +0000</pubDate>
	</item>
</rss>
