Files
rust-openvr/examples/test.rs
2015-07-05 00:06:45 -04:00

41 lines
1.4 KiB
Rust

extern crate vr;
fn main() {
let ivr = vr::IVRSystem::init().unwrap();
println!("bounds: {:?}", ivr.bounds());
println!("recommended size: {:?}", ivr.recommended_render_target_size());
println!("eye output: {:?} {:?}", ivr.eye_viewport(vr::Eye::Left), ivr.eye_viewport(vr::Eye::Right));
println!("projection matrix left {:?}", ivr.projection_matrix(vr::Eye::Left, 0.1, 100.));
println!("projection matrix right {:?}", ivr.projection_matrix(vr::Eye::Right, 0.1, 100.));
for u in 0..4 {
for v in 0..4 {
let pos = ivr.compute_distortion(
vr::Eye::Left,
u as f32 / 4.,
v as f32 / 4.,
);
print!("({:2.4}, {:2.4}) ", pos.red[0], pos.red[1]);
}
println!("");
}
println!("eye_to_head: {:?}", ivr.eye_to_head_transform(vr::Eye::Left));
println!("vsync: {:?}", ivr.time_since_last_vsync());
println!("poses {:?}", ivr.tracked_devices(0.).as_slice());
println!("Trying to create a compositor");
match ivr.compositor() {
Err(err) => println!("Could not create compositor {:?}", err),
Ok(comp) => {
println!("\tCreated one!");
println!("\tis fullscreen ={}", comp.is_fullscreen());
println!("\tis vsync ={}", comp.get_vsync());
println!("\tcan render scene ={}", comp.can_render_scene());
}
}
println!("Done! \\o/");
}