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 vertex array gen/binding and glPolygonMode #24

Merged
merged 2 commits into from Apr 26, 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

35 gl2.rs
@@ -112,9 +112,16 @@ pub static POLYGON_OFFSET_FILL: c_uint = 0x8037 as c_uint;
pub static SAMPLE_ALPHA_TO_COVERAGE: c_uint = 0x809E as c_uint;
pub static SAMPLE_COVERAGE: c_uint = 0x80A0 as c_uint;

/* FrontFaceDirection */
/* Polygons */
pub static POINT: c_uint = 0x1B00 as c_uint;
pub static LINE: c_uint = 0x1B01 as c_uint;
pub static FILL: c_uint = 0x1B02 as c_uint;
pub static CW: c_uint = 0x0900 as c_uint;
pub static CCW: c_uint = 0x0901 as c_uint;
pub static POLYGON_MODE: c_uint = 0x0B40 as c_uint;
pub static POLYGON_SMOOTH: c_uint = 0x0B41 as c_uint;
pub static POLYGON_STIPPLE: c_uint = 0x0B42 as c_uint;
pub static EDGE_FLAG: c_uint = 0x0B43 as c_uint;

/* GetPName */
pub static LINE_WIDTH: c_uint = 0x0B21 as c_uint;
@@ -388,6 +395,12 @@ pub fn bind_texture(target: GLenum, texture: GLuint) {
}
}

pub fn bind_vertex_array(array: GLuint) {
unsafe {
ll::glBindVertexArray(array);
}
}

pub fn blend_color(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) {
unsafe {
ll::glBlendColor(red, green, blue, alpha);
@@ -633,6 +646,14 @@ pub fn gen_textures(n: GLsizei) -> ~[GLuint] {
}
}

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

pub fn get_attrib_location(program: GLuint, name: ~str) -> c_int {
unsafe {
return as_c_str(name, |name_bytes|
@@ -750,6 +771,12 @@ pub fn pixel_store_i(pname: GLenum, param: GLint) {
}
}

pub fn polygon_mode(face: GLenum, mode: GLenum) {
unsafe {
ll::glPolygonMode(face, mode);
}
}

pub fn shader_source(shader: GLuint, strings: &[~[u8]]) {
unsafe {
let pointers = strings.map(|string| to_ptr(*string));
@@ -939,6 +966,8 @@ pub fn glBindRenderbuffer(++target: GLenum, ++renderbuffer: GLuint);

pub fn glBindTexture(++target: GLenum, ++texture: GLuint);

pub fn glBindVertexArray(++array: GLuint);

pub fn glBlendColor(++red: GLclampf, ++green: GLclampf, ++blue: GLclampf, ++alpha: GLclampf);

pub fn glBlendEquation(++mode: GLenum);
@@ -1035,6 +1064,8 @@ pub fn glGenRenderbuffers(++n: GLsizei, ++renderbuffers: *GLuint);

pub fn glGenTextures(++n: GLsizei, ++textures: *GLuint);

pub fn glGenVertexArrays(++n: GLsizei, arrays: *GLuint);

pub fn glGetActiveAttrib(++program: GLuint, ++index: GLuint, ++bufsize: GLsizei, ++length: *GLsizei, ++size: *GLint, ++_type: *GLenum, ++name: *GLchar);

pub fn glGetActiveUniform(++program: GLuint, ++index: GLuint, ++bufsize: GLsizei, ++length: *GLsizei, ++size: *GLint, ++_type: *GLenum, ++name: *GLchar);
@@ -1112,6 +1143,8 @@ pub fn glPixelStorei(++pname: GLenum, ++param: GLint);

pub fn glPolygonOffset(++factor: GLfloat, ++units: GLfloat);

pub fn glPolygonMode(++face: GLenum, ++mode: GLenum);

pub fn glReadPixels(++x: GLint, ++y: GLint, ++width: GLsizei, ++height: GLsizei, ++format: GLenum, ++_type: GLenum, ++pixels: *GLvoid);

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