[HOpenGL] Depth problem

Ben Christy ben.christy at gmail.com
Mon Oct 25 22:57:14 EDT 2010


That is a mistake, they both should be 0.01.

On Mon, Oct 25, 2010 at 9:01 PM, Nate Young <youngnh at gmail.com> wrote:

>
> 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
> HOpenGL at haskell.org
> http://www.haskell.org/mailman/listinfo/hopengl
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/hopengl/attachments/20101025/165475c7/attachment.html


More information about the HOpenGL mailing list