[HOpenGL] (not?) using preservingMatrix

jamin1001 jamin1001 at yahoo.com
Fri Jan 5 16:19:43 EST 2007


Thank you very much.  I appreciate the detailed response and extra tips!

Jamin



Sebastian Sylvan wrote:
> 
> On 1/5/07, jamin1001 <jamin1001 at yahoo.com> wrote:
>>
>> 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!)
> 
> Not with OpenGL. If you go to the haskell.org website and check out
> the libraries page I'm sure you'll find plenty of linear algebra
> libraries. This is a problem that you have to face in any language,
> btw, at least any language which doesn't include linear algebra
> operations.
> 
> Oh, and also
> 
> do bar
>      xs <- foo
>      return xs
> 
> is equal to
> 
> do bar
>      foo
> 
> I'e you can loose the arrow and the "return".
> 
> 
> /S
> -- 
> Sebastian Sylvan
> +46(0)736-818655
> UIN: 44640862
> _______________________________________________
> HOpenGL mailing list
> HOpenGL at haskell.org
> http://www.haskell.org/mailman/listinfo/hopengl
> 
> 

-- 
View this message in context: http://www.nabble.com/%28not-%29-using-preservingMatrix-tf2926697.html#a8186202
Sent from the Haskell - HOpenGL mailing list archive at Nabble.com.



More information about the HOpenGL mailing list