<br>Hi,<br><br>It's not easy to answer these type of questions without looking at the code, <br>but I guess that you forgot "swapBuffers"; also "postRedisplay" is at the wrong place.<br>Idle callback shouldn't be used in normal circumstances.<br>
<br>In double-buffering mode, by default OpenGL draws on the back plane, and you see the<br>front page. After you finish the drawing, you swap the two using "swapBuffers".<br><br>"postRedisplay Nothing" tells GLUT that the screen is needing a refresh (normal <br>
applications do not render continuously, just when something happens on the screen).<br>If you want continuous animation, I recommend the following code structure, where<br>swapBuffers and postRedisplay are at the end of the display callback:<br>
<br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">-- This is the display callback. You do the drawing here.<br>-- Idle callback shouldn't be used at all. Animation should be depend<br>
</blockquote><div> -- only on time, not on frames. <br></div><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">display = do<br><br> matrixMode $= Projection<br>
loadIdentity<br> -- set projection matrix here, for example:<br> ortho (-1) 1 (-1) 1 (-1) 1<br><br> matrixMode $= Modelview 0<br> loadIdentity<br><br></blockquote><div> t1 <- get elapsedTime <br> let t = fromIntegral t1 * 0.001 :: Double -- elapsed time in seconds<br>
<br></div><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"> -- do some drawing here, depending on "t"<br> renderPrimitive Lines $ do<br>
vertex (Vertex2 ....)<br> -- etc<br><br> swapBuffers -- this is for correct double buffer<br> postRedisplay Nothing -- this is to ensure that the next frame will be rendered, too<br></blockquote>
<br><br>Hope this helps,<br>Balazs<br><br><br><div class="gmail_quote">On Tue, Mar 15, 2011 at 11:19 PM, Francisco Listas <span dir="ltr"><<a href="mailto:francisco.listas@gmail.com">francisco.listas@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello all,<br>
<br>
I am following the tutorial on<br>
<a href="http://www.haskell.org/haskellwiki/OpenGLTutorial2" target="_blank">http://www.haskell.org/haskellwiki/OpenGLTutorial2</a> everything works<br>
ok, but the moment I add "postRedisplay Nothing" to the idle function<br>
nothing is displayed.<br>
I've tried passing the current window to postRedisplay, adding double<br>
buffering (it is supposed to be done internally on mac) but no image.<br>
If I comment out postRedisplay then I can see the image but no animation<br>
<br>
I am using Snow Leopard 10.6 and GHC from the 32bit Haskell Platform 2010.2.0.0<br>
<br>
Any clue to what's happening?<br>
<br>
Thx,<br>
Francisco<br>
<br>
_______________________________________________<br>
HOpenGL mailing list<br>
<a href="mailto:HOpenGL@haskell.org">HOpenGL@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/hopengl" target="_blank">http://www.haskell.org/mailman/listinfo/hopengl</a><br>
</blockquote></div><br>