Why does calling the perspective function leave me with a black screen?

I use Haskell and OpenGL to build a 3D landscape. The terrain and lighting are beautiful, but I have some difficulties setting up the camera / view.

When I run the following code in my function display:

matrixMode $= Projection
loadIdentity
-- perspective 45 1 0.1 100

matrixMode $= ModelView 0
loadIdentity
lookAt (Vertex3 0 0 0) (Vertex3 0 1 2) (Vector3 0 1 0)

I get the following image:

enter image description here

But when I uncomment the line

perspective 45 1 0.1 100

I just get a black screen.

My point array is quite large, but here are the last few points copied from ghci:

(1,0,0,0,0,0,76), (1,0,0,0,0,0,8), (1,0,0,0, 0,84), (1,0,0,0 , 0.88), (1,0,0,0, 0,92), (1,0,0,0, 0,96), (1,0,0,0,1,0)

I think that:

  • Am I defining perspective planes incorrectly? or...
  • Should I not repeatedly call one or more of these functions?
+4
1

/ - ( ) . , . , . KarolisJuodelė, lookAt , ...

enter image description here

+5

All Articles