caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* LablGL - get_matrix problem or silly mistake
@ 2005-12-29 11:54 Grzegorz Malesik
  0 siblings, 0 replies; only message in thread
From: Grzegorz Malesik @ 2005-12-29 11:54 UTC (permalink / raw)
  To: caml-list

I'm using the LablGL 1.0.1 and have a get_matrix related problem. I wonder 
if it actually works (however I'm just a beginner in ocaml so I may be 
wrong).

These instructions should produce an Identity
(1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1) but they usually return all zeros matrix or garbage (very small 
numbers in every position):

GlMat.mode `modelview;
GlMat.push ();
GlMat.load_identity ();
let transform_matrix = GlMat.get_matrix `modelview_matrix in
print_matrix (transform_matrix);


This is the print matrix function:

(* outputs the given matrix *)
let print_matrix matrix =
    let mat = GlMat.to_array(matrix) in
    print_string "[";
    Array.iter(print_separated_float) mat.(0);
    print_string "|\n|";
    Array.iter(print_separated_float) mat.(1);
    print_string "|\n|";
    Array.iter(print_separated_float) mat.(2);
    print_string "|\n|";
    Array.iter(print_separated_float) mat.(3);
    print_string "]\n"

(* outputs a value separated by space*)
let print_separated_float value=
    print_string " ";
    print_float value

And the outputs are:

[ 0. 0. 0. 0.|
| 0. 0. 0. 0.|
| 0. 0. 0. 0.|
| 0. 0. 0. 0.]

or  for example:

[ 2.28332179595e-307 4.88059031922e-311 3.13151362458e-294 
2.28341685958e-307|
| 2.28343723074e-307 2.96413273817e-307 5.63814281666e-311 
8.69169476112e-311|
| 2.73739873907e-312 5.68907071689e-311 2.28349834422e-307 
2.12421456271e-314|
| 1.30372001638e-076 2.17931454446e-311 2.17504790454e-311 
4.3458495987e-311]

Thanks for any suggestions,
    Tom



----------------------------------------------------
Rachunki za telefon? - To już historia!
Na nowy rok dzwoń i rozmawiaj za darmo! Gdziekolwiek, na luzaku:
http://klik.wp.pl/?adr=http%3A%2F%2Fspik.wp.pl%2Fdzwonzadarmo.html&sid=624



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-29 11:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-29 11:54 LablGL - get_matrix problem or silly mistake Grzegorz Malesik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).