Re: (not?) using preservingMatrix

jamin1001 <[email protected]>
Newsgroups gmane.comp.lang.haskell.hopengl
Message-ID <[email protected]>
My last post was eaten by this "Nabble Forums" web page!

...

Ah, you're right.  What didn't compile for me was this additional line after
the preservingMatrix call:
putStr $ "Result matrix: " ++ (show rs) ++ "\n"


Instead, I want to return that value to use outside the call.  This is what
I was after, I think:

rs2 <- preservingMatrix $ do
      loadIdentity
      -- do whatever you want with your your matrix
      rs <- get ((matrix $ Just $ Modelview 0)::StateVar(GLmatrix GLdouble))
      return (rs)
putStr $ "Result matrix: " ++ (show rs2) ++ "\n"

Now, as for question #2, are there any pre-made ways to transform a vector
with a matrix, or do I have to do it by hand (same goes for cross product!)
(see the post
http://groups.google.com/group/comp.graphics.api.opengl/browse_thread/thread/831ee85b6f97eb15/2de3e6d9c6a1a9e5)



jamin1001 wrote:
> 
> 
> 
> Sebastian Sylvan wrote:
>> 
>> On 1/5/07, jamin1001 <[email protected]> wrote:
>>>
>>> Right, I buy that.  But I don't see how the C line
>>>
>>> glGetFloatv (GL_MODELVIEW_MATRIX, your_matrix_result) ;
>>>
>>> can be done, since it writes a result into your_matrix_result, so I
>>> would
>>> need something like:
>>>
>>> preservingMatrix $ do
>>>     loadIdentity
>>>     -- do whatever you want with your your matrix
>>>     rs <- get ((matrix $ Just $ Modelview 0)::StateVar(GLmatrix
>>> GLdouble))
>> 
>> This does indeed compile for me. GHC 6.6.
>> 
>> -- 
>> Sebastian Sylvan
>> +46(0)736-818655
>> UIN: 44640862
>> _______________________________________________
>> HOpenGL mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/hopengl
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%28not-%29-using-preservingMatrix-tf2926697.html#a8184711
Sent from the Haskell - HOpenGL mailing list archive at Nabble.com.
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.