<div dir="ltr">Thanks for the advice everyone.<div><br></div><div>I&#39;m using Haskell rather than C/C++ because I&#39;m not particularly interested in writing an entire application in C/C++. If I learn OpenGL using C, then I&#39;m still going to have to learn to use the bindings in whatever language I ultimately decide to use. Haskell seems well suited to this given all of its nice foreign interface packages. Additionally, knowing how to interface with C libraries seems like a useful skill to have.</div>
<div><br></div><div>I&#39;ve already gone through the first few chapters of the red book using the higher level OpenGL. The concern that lead me to try OpenGLRaw instead is that drawing every vertex/color/etc with a separate function call seems incredibly inefficient. I imagine I&#39;m going to have to learn to use buffers at some point. In fact, there is a section about them in the second chapter of the red book, which I skipped because I couldn&#39;t figure out how to do it with the high level OpenGL package. Also, it seems like the high level package only truly supports the 2.1 spec, whereas the Raw package supports the 3.2 spec.<br>
</div><div><br></div><div>If everyone legitimately thinks that the higher level library is the way to go for writing actual OpenGL programs then I&#39;ll give it another shot.  It looks like the Haskell translations of the red book examples might get me unblocked in that respect. I just felt like I would be better served by learning how to use the lower level bindings, which are closer to actual OpenGL.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Mar 11, 2013 at 6:43 AM, Ertugrul Söylemez <span dir="ltr">&lt;<a href="mailto:es@ertes.de" target="_blank">es@ertes.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Michael Baker &lt;<a href="mailto:michaeltbaker@gmail.com">michaeltbaker@gmail.com</a>&gt; wrote:<br>
<br>
&gt; However, I&#39;m struggling a bit because I haven&#39;t used Haskell&#39;s foreign<br>
&gt; interface before. Here is an attempt which is expected to draw a<br>
&gt; triangle, but instead draws nothing: <a href="http://hpaste.org/83837" target="_blank">http://hpaste.org/83837</a><br>
<br>
</div>The first thing I notice is that you never set a vertex color, which is<br>
black by default in all cases I&#39;ve encountered.  So it may be drawing,<br>
but you may simply not see it. =)<br>
<br>
Before you begin drawing put this somewhere:<br>
<br>
    glColor3f 1 0 0<br>
<br>
That should draw a red shape.  Another option is to set a different<br>
clear color:<br>
<br>
    glClearColor 1 0 0 1<br>
<br>
That sets a red background.<br>
<div class="im"><br>
<br>
&gt; Does anyone know of a tutorial for OpenGLRaw or the foreign interface<br>
&gt; that might help me understand how to marshall data around? It seems<br>
&gt; like many people turn to OpenGLRaw when they&#39;re learning OpenGL so<br>
&gt; that they can follow the tutorials. I imagine it would be useful to<br>
&gt; have a guide out there that covers how to actually use it.<br>
<br>
</div>My recommendation is to go with the higher level OpenGL library.  The<br>
main difference is that the `gl` prefix is dropped and the numerous<br>
similar functions (`color2f`, `color3f`, `color4f`, etc.) are collapsed<br>
into a single polymorphic function `color`:<br>
<br>
    import qualified Graphics.Rendering.OpenGL as GL<br>
<br>
    GL.color (GL.Color3 1 0 (0 :: GL.GLfloat))<br>
<br>
This looks more complicated, but it makes other things a lot easier, so<br>
in the end you win.<br>
<br>
<br>
Greets,<br>
Ertugrul<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Not to be or to be and (not to be or to be and (not to be or to be and<br>
(not to be or to be and ... that is the list monad.<br>
</font></span><br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>