[HOpenGL] Re: HOpenGL on macs?

Carlos Scheidegger carlos.scheidegger at gmail.com
Fri Jun 25 01:20:23 EDT 2004


> > The problem I'm seeing is that the HOpenGL GLUT window is being
> > created without problems, but it seems that no calls are getting
> > through to the driver: nothing I do on the display callback gets
> > rendered. I have no idea what may be happening, but I wonder if you're
> > experiencing the same problem. I'm running OSX 10.3.4 on a
> > Radeon-based iBook..
> 
> No, everything works fine here... more details please (ghc --version,
> source code, build command, ...).
> You might want to Cc the hopengl at haskell.org list, in case someone
> there figures it out.

Sorry for the lack of details in the previous message... 

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.2.1

The source code:

-----
import Graphics.UI.GLUT
import Graphics.Rendering.OpenGL

main =
    do
    (progName, _) <- getArgsAndInitialize
    createAWindow progName
    mainLoop

createAWindow windowName = 
    do
    createWindow windowName
    displayCallback $= displayPoints

displayPoints =
    do
    clearColor $= Color4 1.0 0.0 0.0 1.0
    clear [ColorBuffer]
    renderPrimitive Polygon
       $ mapM_ (\ (x,y,z)-> vertex $ Vertex3 x y z) myPoints
    swapBuffers

myPoints :: [(GLfloat, GLfloat, GLfloat)]
myPoints =
    [(-0.25, 0.25, 0.0)
    ,(0.75, 0.35, 0.0)
    ,(0.75, -0.15, 0.0)
    ,(-0.75, -0.25, 0.0)]
-----

The build command:

$ ghc --make APolygon.hs -o APolygon

What happens is that the window seems to be created ok (at least I get
a window entitled "APolygon"), but the contents of the window are just
plain white. It should be to a red background, and a white polygon
should be drawn.. I don't know if I'm doing anything wrong, but it
doesn't look like it.

I'm sorry I'm unable to give any more OSX specific info.. this is my
first mac and I don't have much developer experience on the platform..

Thanks a lot,
-carlos


More information about the HOpenGL mailing list