aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorTomaka17 <pierre.krieger1708@gmail.com>2014-10-02 22:16:47 +0200
committerTomaka17 <pierre.krieger1708@gmail.com>2014-10-02 22:16:47 +0200
commit0584ac184c8558382009958860cbf742bcf6d43e (patch)
tree863b45174862117118d6c843b1a39edc1cc7d211 /examples
parent5fd00e8b6e5124b5c4bfd9d59cd80d4cd8f63eda (diff)
downloadglutin-0584ac184c8558382009958860cbf742bcf6d43e.tar.gz
glutin-0584ac184c8558382009958860cbf742bcf6d43e.zip
Vertex data for android is now static
Diffstat (limited to 'examples')
-rw-r--r--examples/support/mod.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/examples/support/mod.rs b/examples/support/mod.rs
index 31ccf1d..154b01e 100644
--- a/examples/support/mod.rs
+++ b/examples/support/mod.rs
@@ -52,21 +52,15 @@ impl Context {
self.gl.ClearColor(color.0, color.1, color.2, color.3);
self.gl.Clear(gl::COLOR_BUFFER_BIT);
- let vertex_data: [f32, ..15] = [
- -0.5, -0.5, 1.0, 0.0, 0.0,
- 0.0, 0.5, 0.0, 1.0, 0.0,
- 0.5, -0.5, 0.0, 0.0, 1.0
- ];
-
self.gl.EnableClientState(gl::VERTEX_ARRAY);
self.gl.EnableClientState(gl::COLOR_ARRAY);
unsafe {
use std::mem;
self.gl.VertexPointer(2, gl::FLOAT, (mem::size_of::<f32>() * 5) as i32,
- mem::transmute(vertex_data.as_slice().as_ptr()));
+ mem::transmute(VERTEX_DATA.as_slice().as_ptr()));
self.gl.ColorPointer(3, gl::FLOAT, (mem::size_of::<f32>() * 5) as i32,
- mem::transmute(vertex_data.as_slice().as_ptr().offset(2)));
+ mem::transmute(VERTEX_DATA.as_slice().as_ptr().offset(2)));
}
self.gl.DrawArrays(gl::TRIANGLES, 0, 3);
@@ -74,3 +68,10 @@ impl Context {
self.gl.DisableClientState(gl::COLOR_ARRAY);
}
}
+
+#[cfg(target_os = "android")]
+static VERTEX_DATA: [f32, ..15] = [
+ -0.5, -0.5, 1.0, 0.0, 0.0,
+ 0.0, 0.5, 0.0, 1.0, 0.0,
+ 0.5, -0.5, 0.0, 0.0, 1.0
+];