[HOpenGL] Depth problem
Ben Christy
ben.christy at gmail.com
Sun Oct 24 18:52:07 EDT 2010
I am taking a graphics class and I have a problem I have not been able to
resolve. When I translate along the Z axis objects are clipped before their
size changes. It almost seems likes its stuck using a ortho prjojection some
how. That being said the clip plan is very close and to me does not resemble
the one I set in gluPerspective. It starts to clip after being translated
-0.6 units down the z axis.
Attached is the code that I use to setup the projection matrix.
main = do
(progname, _) ← getArgsAndInitialize
--initialContextVersion 3 0
createWindow "Ben Christy Assignment 2"
windowSize $= Size 800 600
matrixMode $= Projection
loadIdentity
depthFunc $= Just Less
viewport $= (Position 0 0, Size 800 600)
perspective 60 1.333 1 1200
--tableModel ← initModelVBO (vertexTupleListToVertexList table)
changesRef ← newIORef Map.empty
sceneRef ← newIORef buildSSG
balloonState ← newIORef There
balloonZTarget ← newIORef 4
balloonZStart ← newIORef 0
balloonStep ← newIORef 0
balloonNumSteps ← newIORef 0
reshapeCallback $= Just reshape
displayCallback $= (displayScene sceneRef changesRef )
--addTimerCallback 10 (animate sceneRef changesRef balloonState
balloonZTarget balloonZStart balloonStep balloonNumSteps)
keyboardMouseCallback $= Just (handleInput sceneRef changesRef)
mainLoop
reshape (Size w h) = do
print "resize"
matrixMode $= Projection
loadIdentity
depthFunc $= Just Less
viewport $= (Position 0 0, Size w h)
perspective 60 1.333 0.01 1200
matrixMode $= Modelview 1
loadIdentity
postRedisplay Nothing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/hopengl/attachments/20101024/b6228f9b/attachment.html
More information about the HOpenGL
mailing list