diff --git a/examples/common/mod.rs b/examples/common/mod.rs index b241eb53..9417cd7a 100644 --- a/examples/common/mod.rs +++ b/examples/common/mod.rs @@ -68,7 +68,7 @@ impl Shader { gl::ShaderSource( shader, 1, - &(source.as_ptr() as *const GLchar), + &(source.as_ptr().cast()), &(source.len() as GLint), ); ck(); @@ -116,7 +116,7 @@ impl Buffer { gl::BufferData( gl::ARRAY_BUFFER, data.len() as isize, - data.as_ptr() as *const c_void, + data.as_ptr().cast(), gl::STATIC_DRAW, ); ck(); diff --git a/examples/offscreen.rs b/examples/offscreen.rs index 5249b94e..28d42ff5 100644 --- a/examples/offscreen.rs +++ b/examples/offscreen.rs @@ -188,7 +188,7 @@ impl TriVertexArray { ck(); let vertex_buffer = Buffer::from_data(slice::from_raw_parts( - TRI_VERTICES.as_ptr() as *const u8, + TRI_VERTICES.as_ptr().cast(), mem::size_of::() * 3, )); @@ -251,10 +251,10 @@ impl TriProgram { let program = Program::new(vertex_shader, fragment_shader); unsafe { let position_attribute = - gl::GetAttribLocation(program.object, c"aPosition".as_ptr() as *const GLchar); + gl::GetAttribLocation(program.object, c"aPosition".as_ptr().cast()); ck(); let color_attribute = - gl::GetAttribLocation(program.object, c"aColor".as_ptr() as *const GLchar); + gl::GetAttribLocation(program.object, c"aColor".as_ptr().cast()); ck(); TriProgram { program, diff --git a/examples/threads.rs b/examples/threads.rs index dfd3a6ce..7f9ad57e 100644 --- a/examples/threads.rs +++ b/examples/threads.rs @@ -811,26 +811,26 @@ impl BlitProgram { let program = Program::new(vertex_shader, fragment_shader); unsafe { let position_attribute = - gl::GetAttribLocation(program.object, c"aPosition".as_ptr() as *const GLchar); + gl::GetAttribLocation(program.object, c"aPosition".as_ptr().cast()); ck(); let transform_uniform = - gl::GetUniformLocation(program.object, c"uTransform".as_ptr() as *const GLchar); + gl::GetUniformLocation(program.object, c"uTransform".as_ptr().cast()); ck(); let translation_uniform = - gl::GetUniformLocation(program.object, c"uTranslation".as_ptr() as *const GLchar); + gl::GetUniformLocation(program.object, c"uTranslation".as_ptr().cast()); ck(); let tex_transform_uniform = gl::GetUniformLocation( program.object, - c"uTexTransform".as_ptr() as *const GLchar, + c"uTexTransform".as_ptr().cast(), ); ck(); let tex_translation_uniform = gl::GetUniformLocation( program.object, - c"uTexTranslation".as_ptr() as *const GLchar, + c"uTexTranslation".as_ptr().cast(), ); ck(); let source_uniform = - gl::GetUniformLocation(program.object, c"uSource".as_ptr() as *const GLchar); + gl::GetUniformLocation(program.object, c"uSource".as_ptr().cast()); ck(); BlitProgram { program, @@ -883,48 +883,48 @@ impl GridProgram { let program = Program::new(vertex_shader, fragment_shader); unsafe { let position_attribute = - gl::GetAttribLocation(program.object, c"aPosition".as_ptr() as *const GLchar); + gl::GetAttribLocation(program.object, c"aPosition".as_ptr().cast()); ck(); let transform_uniform = - gl::GetUniformLocation(program.object, c"uTransform".as_ptr() as *const GLchar); + gl::GetUniformLocation(program.object, c"uTransform".as_ptr().cast()); ck(); let translation_uniform = - gl::GetUniformLocation(program.object, c"uTranslation".as_ptr() as *const GLchar); + gl::GetUniformLocation(program.object, c"uTranslation".as_ptr().cast()); ck(); let tex_transform_uniform = gl::GetUniformLocation( program.object, - c"uTexTransform".as_ptr() as *const GLchar, + c"uTexTransform".as_ptr().cast(), ); ck(); let tex_translation_uniform = gl::GetUniformLocation( program.object, - c"uTexTranslation".as_ptr() as *const GLchar, + c"uTexTranslation".as_ptr().cast(), ); ck(); let gridline_color_uniform = gl::GetUniformLocation( program.object, - c"uGridlineColor".as_ptr() as *const GLchar, + c"uGridlineColor".as_ptr().cast(), ); ck(); let bg_color_uniform = - gl::GetUniformLocation(program.object, c"uBGColor".as_ptr() as *const GLchar); + gl::GetUniformLocation(program.object, c"uBGColor".as_ptr().cast()); ck(); let radius_uniform = - gl::GetUniformLocation(program.object, c"uRadius".as_ptr() as *const GLchar); + gl::GetUniformLocation(program.object, c"uRadius".as_ptr().cast()); ck(); let camera_position_uniform = gl::GetUniformLocation( program.object, - c"uCameraPosition".as_ptr() as *const GLchar, + c"uCameraPosition".as_ptr().cast(), ); ck(); let light_position_uniform = gl::GetUniformLocation( program.object, - c"uLightPosition".as_ptr() as *const GLchar, + c"uLightPosition".as_ptr().cast(), ); ck(); let sphere_position_uniform = gl::GetUniformLocation( program.object, - c"uSpherePosition".as_ptr() as *const GLchar, + c"uSpherePosition".as_ptr().cast(), ); ck(); GridProgram { @@ -985,54 +985,54 @@ impl CheckProgram { let program = Program::new(vertex_shader, fragment_shader); unsafe { let position_attribute = - gl::GetAttribLocation(program.object, c"aPosition".as_ptr() as *const GLchar); + gl::GetAttribLocation(program.object, c"aPosition".as_ptr().cast()); ck(); let transform_uniform = - gl::GetUniformLocation(program.object, c"uTransform".as_ptr() as *const GLchar); + gl::GetUniformLocation(program.object, c"uTransform".as_ptr().cast()); ck(); let translation_uniform = - gl::GetUniformLocation(program.object, c"uTranslation".as_ptr() as *const GLchar); + gl::GetUniformLocation(program.object, c"uTranslation".as_ptr().cast()); ck(); let tex_transform_uniform = gl::GetUniformLocation( program.object, - c"uTexTransform".as_ptr() as *const GLchar, + c"uTexTransform".as_ptr().cast(), ); ck(); let tex_translation_uniform = gl::GetUniformLocation( program.object, - c"uTexTranslation".as_ptr() as *const GLchar, + c"uTexTranslation".as_ptr().cast(), ); ck(); let rotation_uniform = - gl::GetUniformLocation(program.object, c"uRotation".as_ptr() as *const GLchar); + gl::GetUniformLocation(program.object, c"uRotation".as_ptr().cast()); ck(); let color_a_uniform = - gl::GetUniformLocation(program.object, c"uColorA".as_ptr() as *const GLchar); + gl::GetUniformLocation(program.object, c"uColorA".as_ptr().cast()); ck(); let color_b_uniform = - gl::GetUniformLocation(program.object, c"uColorB".as_ptr() as *const GLchar); + gl::GetUniformLocation(program.object, c"uColorB".as_ptr().cast()); ck(); let viewport_origin_uniform = gl::GetUniformLocation( program.object, - c"uViewportOrigin".as_ptr() as *const GLchar, + c"uViewportOrigin".as_ptr().cast(), ); ck(); let radius_uniform = - gl::GetUniformLocation(program.object, c"uRadius".as_ptr() as *const GLchar); + gl::GetUniformLocation(program.object, c"uRadius".as_ptr().cast()); ck(); let camera_position_uniform = gl::GetUniformLocation( program.object, - c"uCameraPosition".as_ptr() as *const GLchar, + c"uCameraPosition".as_ptr().cast(), ); ck(); let light_position_uniform = gl::GetUniformLocation( program.object, - c"uLightPosition".as_ptr() as *const GLchar, + c"uLightPosition".as_ptr().cast(), ); ck(); let sphere_position_uniform = gl::GetUniformLocation( program.object, - c"uSpherePosition".as_ptr() as *const GLchar, + c"uSpherePosition".as_ptr().cast(), ); ck(); CheckProgram {