Version française
Home     About     Download     Resources     Contact us    
Browse thread
LablGL - get_matrix problem or silly mistake
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Grzegorz Malesik <fnan@w...>
Subject: LablGL - get_matrix problem or silly mistake
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