Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Rust version updates #49

Merged
merged 1 commit into from Aug 8, 2013
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

More Rust version updates

  • Loading branch information
kmcallister committed Aug 7, 2013
commit 81876366bc246f2545705fdf299d559e6c4724fb
18 gl2.rs
@@ -15,8 +15,7 @@ use std::cast::transmute;
use std::cmp;
use std::ptr;
use std::ptr::to_unsafe_ptr;
use std::str;
use std::str::{as_c_str, from_bytes};
use std::str::from_bytes;
use std::str::raw::from_c_str;
use std::sys::size_of;
use std::vec::from_elem;
@@ -36,7 +35,7 @@ extern { }
#[nolink]
#[cfg(target_os = "android")]
#[link_args="-lGLESv2"]
pub extern { }
extern { }

// Constants

@@ -389,7 +388,7 @@ pub fn attach_shader(program: GLuint, shader: GLuint) {

pub fn bind_attrib_location(program: GLuint, index: GLuint, name: ~str) {
unsafe {
do str::as_c_str(name) |cstr| {
do name.as_c_str |cstr| {
glBindAttribLocation(program, index, cstr);
}
}
@@ -704,8 +703,9 @@ pub fn gen_vertex_arrays(n: GLsizei) -> ~[GLuint] {

pub fn get_attrib_location(program: GLuint, name: ~str) -> c_int {
unsafe {
return as_c_str(name, |name_bytes|
glGetAttribLocation(program, name_bytes as *GLchar));
do name.as_c_str |name_bytes| {
glGetAttribLocation(program, name_bytes as *GLchar)
}
}
}

@@ -776,7 +776,7 @@ pub fn get_shader_iv(shader: GLuint, pname: GLenum) -> GLint {

pub fn get_uniform_location(program: GLuint, name: ~str) -> c_int {
unsafe {
do as_c_str(name) |name_bytes| {
do name.as_c_str |name_bytes| {
glGetUniformLocation(program, name_bytes as *GLchar)
}
}
@@ -861,15 +861,15 @@ pub fn read_pixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format:
};

let mut pixels: ~[u8] = ~[];
pixels.reserve(width * height * colors * depth as uint);
pixels.reserve((width * height * colors * depth) as uint);

do pixels.as_mut_buf |buf, _| {
unsafe {
glReadPixels(x, y, width, height, format, pixel_type, cast::transmute(buf));
}
}

unsafe { set_len(&mut pixels, width * height * colors * depth as uint); }
unsafe { set_len(&mut pixels, (width * height * colors * depth) as uint); }

pixels
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.