diff --git a/app-proto/src/display.rs b/app-proto/src/display.rs index 2e9b4f0..59d0dca 100644 --- a/app-proto/src/display.rs +++ b/app-proto/src/display.rs @@ -408,6 +408,8 @@ pub fn Display() -> View { } if scene_changed.get() { + const SPACE_DIM: usize = 3; + /* INSTRUMENTS */ // measure mean frame interval frames_since_last_sample += 1; @@ -486,7 +488,6 @@ pub fn Display() -> View { point(0.0, -0.15, -1.0) ]; - const SPACE_DIM: usize = 3; let asm_to_world_sp = asm_to_world.rows(0, SPACE_DIM); let point_reps_world_sp = point_reps.map(|rep| &asm_to_world_sp * rep); DMatrix::from_columns(&point_reps_world_sp).cast::() @@ -532,7 +533,7 @@ pub fn Display() -> View { // bind the viewport vertex position buffer to the position // attribute in the vertex shader - bind_to_attribute(&ctx, viewport_position_attr, 3, &viewport_position_buffer); + bind_to_attribute(&ctx, viewport_position_attr, SPACE_DIM as i32, &viewport_position_buffer); // draw the scene ctx.draw_arrays(WebGl2RenderingContext::TRIANGLES, 0, VERTEX_CNT as i32); @@ -545,7 +546,7 @@ pub fn Display() -> View { // load the point positions into a new buffer and bind it to the // position attribute in the vertex shader let point_position_buffer = load_new_buffer(&ctx, point_positions.as_slice()); - bind_to_attribute(&ctx, point_position_attr, 3, &point_position_buffer); + bind_to_attribute(&ctx, point_position_attr, SPACE_DIM as i32, &point_position_buffer); // draw the scene ctx.draw_arrays(WebGl2RenderingContext::POINTS, 0, point_positions.ncols() as i32);