Re: Depth problem
Nate Young <[email protected]> Mon, 25 Oct 2010 20:01:46 -0500
| Newsgroups | gmane.comp.lang.haskell.hopengl |
|---|---|
| Message-ID | <[email protected]> |
Hi, I couldn't get your code running to verify you didn't include enough to run the whole program, but I did notice that `main` and `reshape` methods set different zNear values: 1 and 0.01 respectively. How are you translating the object? > 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 > _______________________________________________ HOpenGL mailing list [email protected] http://www.haskell.org/mailman/listinfo/hopengl