Add a frame timer

This commit is contained in:
2022-10-23 00:03:38 +02:00
parent 732c65914f
commit 1fd3893e27
2 changed files with 4 additions and 2 deletions
+4
View File
@@ -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;
-2
View File
@@ -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 {