From: Bernie Innocenti Date: Sat, 22 Apr 2017 22:46:49 +0000 (-0400) Subject: Switch to WebGL 2. X-Git-Tag: v0.6.0~8 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=68e466bb68ba5e5a748a8e86b6eaedbab400c973;p=mandelwow.git Switch to WebGL 2. --- diff --git a/Cargo.toml b/Cargo.toml index 5167759..44b8aec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,8 @@ license = "GPL-3.0+" [dependencies] cgmath = "*" -glium = "0.15.0" -glutin = "0.6.2" +glium = "0.16.0" +glutin = "0.7.4" genmesh = "0.4.1" image = "0.12.0" obj = { version = "0.5", features = ["usegenmesh"] } @@ -28,6 +28,8 @@ backtrace = "0.2.3" [replace] "backtrace:0.2.3" = { git = "https://github.com/badboy/backtrace-rs", branch = "emscripten-fix" } +"glutin:0.7.4" = { path = "/home/bernie/src/glutin" } +"glium:0.16.0" = { path = "/home/bernie/src/glium" } [[bin]] name = "mandelwow" diff --git a/main.rs b/main.rs index d1582dc..c63add0 100644 --- a/main.rs +++ b/main.rs @@ -35,6 +35,15 @@ fn screenshot(display : &glium::Display) { image.save(&mut output, image::ImageFormat::PNG).unwrap(); } +fn gl_info(display : &glium::Display) { + let version = *display.get_opengl_version(); + let api = match version { + glium::Version(glium::Api::Gl, _, _) => "OpenGL", + glium::Version(glium::Api::GlEs, _, _) => "OpenGL ES" + }; + println!("{} context verson: {}", api, display.get_opengl_version_string()); +} + #[allow(non_camel_case_types)] type em_callback_func = unsafe extern fn(); extern { @@ -63,7 +72,7 @@ fn main() { let _soundplayer = sound::start(); let display = glutin::WindowBuilder::new() - .with_dimensions(300, 300) + .with_dimensions(600, 600) //.with_fullscreen(glutin::get_primary_monitor()) .with_depth_buffer(24) .with_vsync() @@ -71,12 +80,7 @@ fn main() { .build_glium() .unwrap(); - let version = *display.get_opengl_version(); - let api = match version { - glium::Version(glium::Api::Gl, _, _) => "OpenGL", - glium::Version(glium::Api::GlEs, _, _) => "OpenGL ES" - }; - println!("{} context verson: {}", api, display.get_opengl_version_string()); + gl_info(&display); let mandelwow_program = mandelwow::program(&display); let bounding_box_program = bounding_box::solid_fill_program(&display); diff --git a/solid.frag b/solid.frag index c7e5a51..2fed3bf 100644 --- a/solid.frag +++ b/solid.frag @@ -1,5 +1,8 @@ -#version 100 +#version 300 es +precision lowp float; + +out vec4 color; void main() { - gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); + color = vec4(1.0, 1.0, 1.0, 1.0); } diff --git a/solid.vert b/solid.vert index e66723f..6dd30a4 100644 --- a/solid.vert +++ b/solid.vert @@ -1,5 +1,7 @@ -#version 100 -attribute vec3 position; +#version 300 es +precision lowp float; + +in vec3 position; uniform mat4 perspective; uniform mat4 view; uniform mat4 model;