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

Added various missing functions/constants #4

Merged
merged 5 commits into from Mar 19, 2013
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Added glBufferSubData, glDeleteShader, and glDetachShader

  • Loading branch information
sp0 committed Mar 17, 2013
commit eb91c823f3894ae3a18e01e1a169d9deb1097d3f
24 gl2.rs
@@ -273,6 +273,18 @@ pub fn buffer_data<T>(target: GLenum, data: &[T], usage: GLenum) {
}
}

// FIXME: As above
// Note: offset is the element offset index, not byte offset
pub fn buffer_sub_data<T>(target: GLenum, element_offset_index: uint, data: &[T]) {
unsafe {
let size = size_of::<T>();
ll::glBufferSubData(target,
(element_offset_index * size) as GLintptr,
(data.len() * size) as GLsizeiptr,
to_ptr(data) as *GLvoid);
}
}

pub fn check_framebuffer_status(target: GLenum) -> GLenum {
unsafe {
ll::glCheckFramebufferStatus(target)
@@ -309,12 +321,24 @@ pub fn create_shader(shader_type: GLenum) -> GLuint {
}
}

pub fn delete_shader(shader: GLuint) {
unsafe {
ll::glDeleteShader(shader);
}
}

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

pub fn detach_shader(program: GLuint, shader: GLuint) {
unsafe {
ll::glDetachShader(program, shader);
}
}

pub fn draw_arrays(mode: GLenum, first: GLint, count: GLsizei) {
unsafe {
return ll::glDrawArrays(mode, first, count);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.