Re: (not?) using preservingMatrix

"Sebastian Sylvan" <[email protected]>
Newsgroups gmane.comp.lang.haskell.hopengl
Message-ID <[email protected]>
On 1/5/07, jamin1001 <[email protected]> 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
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.