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

Adapt to rust changes #1

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

Always

Just for now

36 gl2.rs
@@ -238,24 +238,24 @@ fn compile_shader(shader: GLuint) {
}

fn create_program() -> GLuint {
ret ll::glCreateProgram();
return ll::glCreateProgram();
}

fn create_shader(shader_type: GLenum) -> GLuint {
ret ll::glCreateShader(shader_type);
return ll::glCreateShader(shader_type);
}

fn delete_textures(textures: &[GLuint]) unsafe {
ret ll::glDeleteTextures(textures.len() as GLsizei, to_ptr_slice(textures));
return ll::glDeleteTextures(textures.len() as GLsizei, to_ptr_slice(textures));
}

fn draw_arrays(mode: GLenum, first: GLint, count: GLsizei) {
ret ll::glDrawArrays(mode, first, count);
return ll::glDrawArrays(mode, first, count);
}

fn draw_elements(mode: GLenum, element_type: GLenum, indices: ~[u8]) unsafe {
ret ll::glDrawElements(mode, indices.len() as GLsizei, element_type,
to_ptr(indices) as *c_void);
return ll::glDrawElements(mode, indices.len() as GLsizei, element_type,
to_ptr(indices) as *c_void);
}

fn enable(cap: GLenum) {
@@ -267,61 +267,61 @@ fn enable_vertex_attrib_array(index: GLuint) {
}

fn finish() {
ret ll::glFinish();
return ll::glFinish();
}

fn flush() {
ret ll::glFlush();
return ll::glFlush();
}

fn gen_buffers(n: GLsizei) -> ~[GLuint] unsafe {
let result = from_elem(n as uint, 0 as GLuint);
ll::glGenBuffers(n, to_ptr(result));
ret result;
return result;
}

fn gen_textures(n: GLsizei) -> ~[GLuint] unsafe {
let result = from_elem(n as uint, 0 as GLuint);
ll::glGenTextures(n, to_ptr(result));
ret result;
return result;
}

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

fn get_error() -> GLenum {
ret ll::glGetError();
return ll::glGetError();
}

fn get_program_iv(program: GLuint, pname: GLenum) -> GLint unsafe {
let result: GLint = 0 as GLint;
ll::glGetProgramiv(program, pname, addr_of(result));
ret result;
return result;
}

fn get_shader_info_log(shader: GLuint) -> ~str unsafe {
let result = from_elem(1024u, 0u8);
let result_len: GLsizei = 0 as GLsizei;
ll::glGetShaderInfoLog(shader, 1024 as GLsizei, addr_of(result_len),
to_ptr(result) as *GLchar);
ret from_bytes(result);
return from_bytes(result);
}

fn get_shader_iv(shader: GLuint, pname: GLenum) -> GLint unsafe {
let result: GLint = 0 as GLint;
ll::glGetShaderiv(shader, pname, addr_of(result));
ret result;
return result;
}

fn get_uniform_location(program: GLuint, name: ~str) -> c_int unsafe {
ret as_c_str(name, |name_bytes|
ll::glGetUniformLocation(program, name_bytes as *GLchar));
return as_c_str(name, |name_bytes|
ll::glGetUniformLocation(program, name_bytes as *GLchar));
}

fn link_program(program: GLuint) {
ret ll::glLinkProgram(program);
return ll::glLinkProgram(program);
}

fn pixel_store_i(pname: GLenum, param: GLint) unsafe {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.