aboutsummaryrefslogtreecommitdiffstats
path: root/examples/support
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-08-30 21:11:58 +0200
committertomaka <pierre.krieger1708@gmail.com>2015-08-30 21:11:58 +0200
commit01fc9a70cdad712d0050755540a089f1d8b47fb2 (patch)
tree1898bdac652d7151126452e606747cd39d92400b /examples/support
parentded23549eb66b9b144f6d710f8861d09c8769947 (diff)
parent326ea3555b348bea89cb467c06a90536106c9f7d (diff)
downloadglutin-01fc9a70cdad712d0050755540a089f1d8b47fb2.tar.gz
glutin-01fc9a70cdad712d0050755540a089f1d8b47fb2.zip
Merge pull request #591 from tomaka/fix-triangle
Fix the triangle in the examples
Diffstat (limited to 'examples/support')
-rw-r--r--examples/support/mod.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/examples/support/mod.rs b/examples/support/mod.rs
index 7e9aa4f..ab8e2a1 100644
--- a/examples/support/mod.rs
+++ b/examples/support/mod.rs
@@ -46,9 +46,12 @@ pub fn load(window: &glutin::Window) -> Context {
(VERTEX_DATA.len() * mem::size_of::<f32>()) as gl::types::GLsizeiptr,
VERTEX_DATA.as_ptr() as *const _, gl::STATIC_DRAW);
- /*let mut vao = mem::uninitialized();
- gl.GenVertexArrays(1, &mut vao);
- gl.BindVertexArray(vao);*/
+ if gl.BindVertexArray.is_loaded() {
+ let mut vao = mem::uninitialized();
+ gl.GenVertexArrays(1, &mut vao);
+ gl.BindVertexArray(vao);
+ }
+
let pos_attrib = gl.GetAttribLocation(program, b"position\0".as_ptr() as *const _);
let color_attrib = gl.GetAttribLocation(program, b"color\0".as_ptr() as *const _);
gl.VertexAttribPointer(pos_attrib as gl::types::GLuint, 2, gl::FLOAT, 0,
@@ -85,11 +88,12 @@ static VERTEX_DATA: [f32; 15] = [
const VS_SRC: &'static [u8] = b"
#version 100
+precision mediump float;
-lowp attribute vec2 position;
-lowp attribute vec3 color;
+attribute vec2 position;
+attribute vec3 color;
-lowp varying vec3 v_color;
+varying vec3 v_color;
void main() {
gl_Position = vec4(position, 0.0, 1.0);
@@ -99,8 +103,9 @@ void main() {
const FS_SRC: &'static [u8] = b"
#version 100
+precision mediump float;
-lowp varying vec3 v_color;
+varying vec3 v_color;
void main() {
gl_FragColor = vec4(v_color, 1.0);