[HOpenGL] (not?) using preservingMatrix
Sebastian Sylvan
sebastian.sylvan at gmail.com
Fri Jan 5 15:08:32 EST 2007
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
More information about the HOpenGL
mailing list