Add a frame timer
This commit is contained in:
@@ -6,6 +6,7 @@ extern crate load_file;
|
|||||||
|
|
||||||
use glium::texture::SrgbTexture2d;
|
use glium::texture::SrgbTexture2d;
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
use std::time::Instant;
|
||||||
|
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use glium::{glutin, Surface};
|
use glium::{glutin, Surface};
|
||||||
@@ -237,6 +238,7 @@ fn main() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// drawing a frame
|
// drawing a frame
|
||||||
|
let start = Instant::now();
|
||||||
let mut target = display.draw();
|
let mut target = display.draw();
|
||||||
target.clear_color_and_depth((0.0, 0.0, 0.0, 0.0), 1.0);
|
target.clear_color_and_depth((0.0, 0.0, 0.0, 0.0), 1.0);
|
||||||
target
|
target
|
||||||
@@ -249,6 +251,8 @@ fn main() {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
target.finish().unwrap();
|
target.finish().unwrap();
|
||||||
|
let duration = start.elapsed();
|
||||||
|
println!("Time elapsed is: {:?}", duration);
|
||||||
|
|
||||||
let mut action = support::Action::Continue;
|
let mut action = support::Action::Continue;
|
||||||
|
|
||||||
|
|||||||
@@ -145,8 +145,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
|||||||
|
|
||||||
let biome = get_biome(biomes_line, columns_index / 2);
|
let biome = get_biome(biomes_line, columns_index / 2);
|
||||||
|
|
||||||
// TODO: compute normals if necessary.
|
|
||||||
|
|
||||||
// First triangle.
|
// First triangle.
|
||||||
|
|
||||||
vertex_data.push(Vertex {
|
vertex_data.push(Vertex {
|
||||||
|
|||||||
Reference in New Issue
Block a user