mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
Fix the GLES code in examples/support/mod.rs
This commit is contained in:
parent
c1ca5d1d87
commit
2f9272e1cb
|
@ -53,6 +53,8 @@ impl Context {
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
pub fn draw_frame(&self, color: (f32, f32, f32, f32)) {
|
pub fn draw_frame(&self, color: (f32, f32, f32, f32)) {
|
||||||
|
use std::mem;
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
self.gl.ClearColor(color.0, color.1, color.2, color.3);
|
self.gl.ClearColor(color.0, color.1, color.2, color.3);
|
||||||
self.gl.Clear(gl::COLOR_BUFFER_BIT);
|
self.gl.Clear(gl::COLOR_BUFFER_BIT);
|
||||||
|
@ -60,13 +62,10 @@ impl Context {
|
||||||
self.gl.EnableClientState(gl::VERTEX_ARRAY);
|
self.gl.EnableClientState(gl::VERTEX_ARRAY);
|
||||||
self.gl.EnableClientState(gl::COLOR_ARRAY);
|
self.gl.EnableClientState(gl::COLOR_ARRAY);
|
||||||
|
|
||||||
unsafe {
|
|
||||||
use std::mem;
|
|
||||||
self.gl.VertexPointer(2, gl::FLOAT, (mem::size_of::<f32>() * 5) as i32,
|
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_ptr()));
|
||||||
self.gl.ColorPointer(3, gl::FLOAT, (mem::size_of::<f32>() * 5) as i32,
|
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_ptr().offset(2)));
|
||||||
}
|
|
||||||
|
|
||||||
self.gl.DrawArrays(gl::TRIANGLES, 0, 3);
|
self.gl.DrawArrays(gl::TRIANGLES, 0, 3);
|
||||||
self.gl.DisableClientState(gl::VERTEX_ARRAY);
|
self.gl.DisableClientState(gl::VERTEX_ARRAY);
|
||||||
|
|
Loading…
Reference in a new issue