[Haskell-cafe] HopenGL

Jason Dagit dagit at codersbase.com
Thu Jun 7 20:19:02 EDT 2007


On 6/7/07, Ruben Zilibowitz <r.zilibowitz at student.unsw.edu.au> wrote:
> Hi,
>
> Thanks for the reply. The Lines.hs example program seems to work just
> right. Unfortunately I still can't get colored lines to work in my 3d
> program.

> Maybe it has something to do with the fact my one is 3d and
> the example program is in 2d.

This is unlikely because of the way OpenGL does 3d vs. 2d.  In OpenGL,
2d is just a special case of 3d where 0 is used for the z coordinate.

More likely than 3d vs. 2d is that you're not drawing in the correct
part of coordinate space, the view volume is incorrect or something
like that.

I would try to work Lines.hs into your current example or start
borrowing code from it and putting them into your example until you
either break Lines.hs in the same way or your example starts to work.
Does Lines.hs still work when you switch it over to 3d?  It should,
but that could be a nice test to help you debug things.

Did you remember to do all the double buffering operations?  Did you
setup the clear color first?  One thing that you have to be careful
about with OpenGL is that you correctly manage the state of the opengl
machine.  Haskell should have a purely functional scene graph built on
top of HOpenGL -- it's something I would like to work on -- but no one
seems to be doing it.  For me at least, it's a matter of time and
priority.  Maybe in a few months to a year I'll get some time for it,
but don't hold your breath :)

Jason


More information about the Haskell-Cafe mailing list