[Haskell-beginners] HOpenGL questions

Nathan Huesken haskell at lonely-star.org
Tue May 18 19:10:27 EDT 2010


I send this mail to the HOpenGL mailinglist. I did not get a reply. I
hope it is OK to ask this question here.

I am new to Haskell, but not new to OpenGL. I am reading the tutorials
on the HOpenGL page and have a few questions.

- First of all, all tutorials are using GLUT. Is that really the way to
  go with HOpenGL? They define (among other things) a onIdle and a
  onDraw function. That seems to me (at least for a game) not the way
  to go. onIdle updates the game logic, and onDraw draws the screen. As
  far as I can see, it does not make sense to update the game logic
  more than once between consecutive calls to onDraw. Same thing is
  true for class to onDraw between consecutive class to onIdle. Is this
  accounted for in the approach?

- In addition there is the onInput function. The onInput, onIdle and
  onDraw functions communicate (in the tutorials) using variables
  declared with newIORef. I come from the OO language C++ and almost no
  experience with functional languages. But this puzzles me. Basically
  they define global variables for  the exchange between the callback
  functions, correct?!? So, for every piece of information I want to
  pass between these functions, I have to declare a newIORef variable?

In C/C++ I find GLUT not a very good approach and prefer plain OpenGL.
Does it make sense to go with plain OpenGL in Haskell too? Are there
any resources on how to do that?


More information about the Beginners mailing list