[HOpenGL] problem with displayCallback and Double buffering
Sven Panne
Sven.Panne at informatik.uni-muenchen.de
Fri Oct 31 18:48:53 EST 2003
Marc A. Ziegert wrote:
> does anyone else have this problem? i want to use double buffering,
> but swapBuffers does not seem to work.
Works for me with the current version from CVS on x86 Linux, see below.
> to set the active window to... the active window (i think that has
> to work!) does not work, too. [...]
I guess with "active" you mean "current", but this works for me, too.
Remember that you can't access currentWindow (or windowPosition,
windowSize, etc.) before mainLoop is entered, this is how GLUT works.
Cheers,
S.
----------------------------------------------------------------------
import Graphics.UI.GLUT
dc :: DisplayCallback
dc = do
clearColor $= Color4 0 0 1 0
clear [ColorBuffer, DepthBuffer]
putStrLn "begin swapBuffers"
swapBuffers
putStrLn "end swapBuffers"
main :: IO ()
main = do
getArgsAndInitialize
initialDisplayMode $= [DoubleBuffered, WithDepthBuffer]
b <- get displayModePossible
putStrLn $ "displayModePossible? ..." ++ show b
createWindow "main"
displayCallback $= dc
mainLoop
----------------------------------------------------------------------
panne at jeanluc:~> ghc --make first.hs
Chasing modules from: first.hs
Compiling Main ( first.hs, first.o )
Linking ...
panne at jeanluc:~> ./a.out
displayModePossible? ...True
begin swapBuffers
end swapBuffers
[ blue window appears, iconized it and de-iconized it again ]
begin swapBuffers
end swapBuffers
More information about the HOpenGL
mailing list