I'm looking at the GtkGL tutorial here, and I'm doing some modifications. Specifically, when I introduce a rotation:
Gtk.timeoutAddFull (do
preservingMatrix $ do -- from here
matrixMode $= Modelview 0
rotate 10 (Vector3 0.0 1.0 (0.0 :: GLfloat)) -- to here
Gtk.widgetQueueDraw canvas
return True)
Gtk.priorityDefaultIdle animationWaitTime
It works nicely. However, when I introduce a lookAt in the display function:
display = do
loadIdentity
color (Color3 1 1 1 :: Color3 GLfloat)
renderPrimitive Polygon $ do
vertex (Vertex3 0.0 0.0 0.0 :: Vertex3 GLfloat)
vertex (Vertex3 1.0 0.0 0.0 :: Vertex3 GLfloat)
vertex (Vertex3 1.0 1.0 0.0 :: Vertex3 GLfloat)
vertex (Vertex3 0.0 1.0 0.0 :: Vertex3 GLfloat)
preservingMatrix $ do -- from here
matrixMode $= Modelview 0
loadIdentity
lookAt (Vertex3 0 1 0) (Vertex3 1 1 0) (Vector3 0 1 0) -- to here
flush
The camera changes its position, but the rotation does not happen.