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

draw_elements: Separate count from the (optional) element list. Allows buffered drawing. #16

Merged
merged 1 commit into from Apr 18, 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

draw_elements: Separate count from the (optional) element list. Allow…

…s buffered drawing.

Fixes #13
  • Loading branch information
robn committed Apr 12, 2013
commit 59109b2f054899e1238598391ca1387a5df2904c
12 gl2.rs
@@ -531,12 +531,18 @@ pub fn draw_arrays(mode: GLenum, first: GLint, count: GLsizei) {
}
}

pub fn draw_elements(mode: GLenum, element_type: GLenum, indices: &[u8]) {
pub fn draw_elements(mode: GLenum, count: GLsizei, element_type: GLenum, indices: Option<&[u8]>) {
unsafe {
return ll::glDrawElements(mode,
indices.len() as GLsizei,
match indices {
Some(ref i) => cmp::min(count, i.len() as GLsizei),
None => count,
},
element_type,
cast::transmute(&indices[0]));
match indices {
Some(ref i) => cast::transmute(&i[0]),
None => ptr::null(),
})
}
}

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