
Sorry for being such a nOOb, (just starting with Haskell...) but how exactly do I compile your "Hello.hs"? When I: -----------------------------------
ghc -package GLUT Hello.hs
Hello.hs:16: Variable not in scope: `clear' Hello.hs:16: Data constructor not in scope: `ColorBuffer' Hello.hs:20: Variable not in scope: `color' Hello.hs:20: Data constructor not in scope: `Color3' Hello.hs:20: Type constructor or class not in scope: `GLfloat' Hello.hs:21: Variable not in scope: `withBeginMode' Hello.hs:21: Data constructor not in scope: `Polygon' Hello.hs:21: Variable not in scope: `vertex' Hello.hs:21: Data constructor not in scope: `Vertex3' Hello.hs:21: Data constructor not in scope: `Vertex3' Hello.hs:21: Data constructor not in scope: `Vertex3' Hello.hs:21: Data constructor not in scope: `Vertex3' Hello.hs:21: Type constructor or class not in scope: `GLfloat' Hello.hs:29: Variable not in scope: `flush' Hello.hs:34: Variable not in scope: `clearColor' Hello.hs:34: Data constructor not in scope: `Color4' Hello.hs:34: Variable not in scope: `$=' Hello.hs:37: Variable not in scope: `matrixMode' Hello.hs:37: Data constructor not in scope: `Projection' Hello.hs:37: Variable not in scope: `$=' Hello.hs:38: Variable not in scope: `loadIdentity' Hello.hs:39: Variable not in scope: `ortho' Hello.hs:50: Variable not in scope: `getArgsAndInitialize' Hello.hs:51: Variable not in scope: `initialDisplayMode' Hello.hs:51: Variable not in scope: `$=' Hello.hs:52: Variable not in scope: `initialWindowSize' Hello.hs:52: Data constructor not in scope: `Size' Hello.hs:52: Variable not in scope: `$=' Hello.hs:53: Variable not in scope: `initialWindowPosition' Hello.hs:53: Data constructor not in scope: `Position' Hello.hs:53: Variable not in scope: `$=' Hello.hs:56: Variable not in scope: `displayCallback' Hello.hs:56: Variable not in scope: `$=' ----------------------------------- On Monday 21 April 2003 15:58, Sven Panne wrote:
Bas van Dijk wrote:
I built GHC from sources using --enable-hopengl at configuration time. [...]
In that case "-package GLUT" is OK. The GLUT package depends on the OpenGL package (cf. the output of "ghc-pkg --show-package=GLUT"), so there is no need for an explicit "-package OpenGL". The reason for the new package names is a cleaner separation of the rendering part (GL/GLU in package "OpenGL") and the UI part (GLUT in package "GLUT"). The error you get is caused by the fact that the new API in CVS uses hierarchical modules, while the examples on the web pages are for the old modules. Another basic difference is that the new API is modeled around the notion of "state variables"
http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libraries/OpenGL/Graphics /Rendering/OpenGL/GL/StateVar.hs?rev=1.1&content-type=text/x-cvsweb-markup
which mirrors the OpenGL state machine very closely and gives a unified view of getters and setters, e.g. the current viewport has the type
viewport :: StateVar (Position, Size)
So you can set the viewport with
viewport $= (Position 10 10, Size 20 20)
and retrieve the current viewport with
(Position x y, Size w h) <- get viewport
OpenGL state which can only be queried has a different type, e.g.
maxViewportDims :: GettableStateVar Size
which allows
mvd <- get maxViewportDims
but catches the following error at compile-time:
maxViewportDims $= Size 30 40
Some examples with the new API:
http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libraries/GLUT/examples/R edBook/Hello.hs?rev=1.4&content-type=text/x-cvsweb-markup http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libraries/GLUT/examples/R edBook/Smooth.hs?rev=1.3&content-type=text/x-cvsweb-markup
After this small digression, here my advice: If you want to use Haskell + OpenGL *now*, you should probably use HOpenGL 1.04 from http://haskell.org/HOpenGL, not the stuff from CVS. Switching to the new API in the future will be relatively easy because there are no subtle semantic changes, mostly syntax.
Cheers, S.
_______________________________________________ HOpenGL mailing list HOpenGL@haskell.org http://www.haskell.org/mailman/listinfo/hopengl