
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@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

Carlos Scheidegger wrote:
[...] 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 guess this is not Mac-specific at all: You don't use initialDisplayMode, so a single buffered window will be created by default. But you are using swapBuffers in your display callback, which is for double buffered windows. I'm not sure what exactly happens on Mac OS X then, but it is not correct on any platform. Two easy fixes: You can either request a double buffered window via "initializeDisplayMode [ ..., DoubleBuffered, ... ]" (before you create the window, of course), or you can use flush instead of swapBuffers. Cheers, S.

Heh. interestingly enough, I didn't remember needing the glFlush()
call in Windows platforms (where I had used glut before), but now I
think I recall reading something about that. With flush :: IO() it
works. Sorry to bother you all with stupid things.
Maybe the HOpenGL tutorial should include flush in the calls, then. I
forgot that GLUT defaults to single-buffered.. My bad.
Thanks all,
-carlos
On Fri, 25 Jun 2004 08:55:27 +0200, Sven Panne
Carlos Scheidegger wrote:
[...] 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 guess this is not Mac-specific at all: You don't use initialDisplayMode, so a single buffered window will be created by default. But you are using swapBuffers in your display callback, which is for double buffered windows. I'm not sure what exactly happens on Mac OS X then, but it is not correct on any platform. Two easy fixes: You can either request a double buffered window via "initializeDisplayMode [ ..., DoubleBuffered, ... ]" (before you create the window, of course), or you can use flush instead of swapBuffers.
Cheers, S.

Maybe the HOpenGL tutorial should include flush in the calls, then. I forgot that GLUT defaults to single-buffered.. My bad. Just to clarify: I got the original example from Sven Pannitz's HOpenGL tutorial, and it doesn't include flush calls in the examples...
-carlos
participants (2)
-
Carlos Scheidegger
-
Sven Panne