Hitdetection

Patrick Scheibe <[email protected]>
Newsgroups gmane.comp.lang.haskell.hopengl
Message-ID <[email protected]>
Hi,

A picture of my quadgame is atached.
I need a kind of hitdetection for knowing where the player want's to set the 
next stone. I copied for testing the code of Sven but it doesn't work in the 
right way...

As shown in the PickDepth or PickSquare example I added some hitrecord names 
to each grey square on the picture. When you click on the window, the same 
code like in the examples is executed. Except of the ortho2D call after the 
pickMatrix... I do not exactly know, what I have to fill there..
I tried it in the following way:

justifyCamera :: GamePackage -> IO ()
justifyCamera gp = do
  let C {cp = camPers, cla=camLook} = gpGetCam gp
      (a,r,n,f) = camPers
      (e,c,u) = camLook
--  matrixMode $= Projection
--  loadIdentity
  GLU.perspective a r n f
--  matrixMode $= Modelview 0
--  loadIdentity
  GLU.lookAt e c u

I just commented out the change of the matrixMode. But that isn't right..
I have hits anywhere in the space but not on the planes :(

Any good ideas? Or is there a good tutorial except of the gluSpec? My problem 
is that I don't understand how it should work in all details.

Best regards
Patrick

_______________________________________________
HOpenGL mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/hopengl
quad.jpg (image/jpeg, 56.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.