0

我在这里查看 GtkGL 教程,并且正在做一些修改。具体来说,当我引入轮换时:

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

它工作得很好。但是,当我在显示函数中引入一个lookAt 时:

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

相机改变了它的位置,但没有发生旋转。

4

0 回答 0