
Hi, Thanks. I eventually figured it out by doing pretty much what you suggested with Lines.hs. I discovered that the thing that made lines come out only in black was: lighting $= Enabled So disabling lighting before drawing lines and re-enabling it afterwards allows me to draw colored lines now. Thanks for the suggestions. Ruben On 08/06/2007, at 10:19 AM, Jason Dagit wrote:
On 6/7/07, Ruben Zilibowitz
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