OpenCores
URL https://opencores.org/ocsvn/pdp1/pdp1/trunk

Subversion Repositories pdp1

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 14 to Rev 15
    Reverse comparison

Rev 14 → Rev 15

/pdp1/trunk/sw/src/main.rs
50,6 → 50,8
// Docs say to use dynamic, persistent might be GL4?
let mut vertex_buffer : glium::VertexBuffer<Vertex> =
glium::VertexBuffer::empty_dynamic(&window, vbmax).unwrap();
// Possible todo: add line support, perhaps modulated
// by beam trace speed.
let indices = glium::index::NoIndices(
glium::index::PrimitiveType::Points);
 
67,7 → 69,6
}
"#;
 
// TODO: falloff, blending?
// Should use a uniform to indicate current time
// Possibly add a timestamp per lit dot?
let fragment_shader_src = r#"
94,6 → 95,29
};
 
let t0 = time::get_time();
 
use std::sync::mpsc::{channel, Receiver};
let verts : Receiver<Vertex> = (|| {
use std::thread::spawn;
 
let (tx, rx) = channel();
spawn(move || {
loop {
let now = (time::get_time() - t0)
.num_microseconds().unwrap() as f32;
let mut str = String::new();
std::io::stdin().read_line(&mut str).unwrap();
// FIXME: Parse line.
let mut words = str.split_whitespace();
let x = words.next().unwrap().parse().unwrap();
let y = words.next().unwrap().parse().unwrap();
let v = Vertex {position: [x, y], time: now };
tx.send(v).unwrap();
//println!("Vertex: {:?}", [x,y]);
}
});
rx
})();
loop {
for event in window.poll_events() {
122,16 → 146,10
vbindex = (vbindex+1) % vbmax;
}
// TODO: Read points from e.g. stdin
for _ in 0..30 {
let mut str = String::new();
std::io::stdin().read_line(&mut str).unwrap();
// FIXME: Parse line.
let mut words = str.split_whitespace();
let x = words.next().unwrap().parse().unwrap();
let y = words.next().unwrap().parse().unwrap();
 
wvb.set(vbindex,
Vertex {position: [x, y], time: now });
for v in verts.try_iter() {
//println!("Vertex: {:?} {} {}",
// v.position, v.time, now);
wvb.set(vbindex, v);
vbindex = (vbindex+1) % vbmax;
}
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.