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 glDepthFunc, glDepthMask and StencilFunction consts. #7

Merged
merged 4 commits into from Apr 8, 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

Prev

Added blend functions and constants

  • Loading branch information
sp0 committed Apr 8, 2013
commit f2f00fd321d792b293334ecabfc423ea70c49caa
66 gl2.rs
@@ -35,6 +35,42 @@ pub static DEPTH_BUFFER_BIT: c_uint = 0x00000100 as c_uint;
pub static STENCIL_BUFFER_BIT: c_uint = 0x00000400 as c_uint;
pub static COLOR_BUFFER_BIT: c_uint = 0x00004000 as c_uint;

/* BlendingFactorDest */
pub static ZERO: c_uint = 0 as c_uint;
pub static ONE: c_uint = 1 as c_uint;
pub static SRC_COLOR: c_uint = 0x0300 as c_uint;
pub static ONE_MINUS_SRC_COLOR: c_uint = 0x0301 as c_uint;
pub static SRC_ALPHA: c_uint = 0x0302 as c_uint;
pub static ONE_MINUS_SRC_ALPHA: c_uint = 0x0303 as c_uint;
pub static DST_ALPHA: c_uint = 0x0304 as c_uint;
pub static ONE_MINUS_DST_ALPHA: c_uint = 0x0305 as c_uint;

/* BlendingFactorSrc */
pub static DST_COLOR: c_uint = 0x0306 as c_uint;
pub static ONE_MINUS_DST_COLOR: c_uint = 0x0307 as c_uint;
pub static SRC_ALPHA_SATURATE: c_uint = 0x0308 as c_uint;

/* BlendEquationSeparate */
pub static FUNC_ADD: c_uint = 0x8006 as c_uint;
pub static BLEND_EQUATION: c_uint = 0x8009 as c_uint;
pub static BLEND_EQUATION_RGB: c_uint = 0x8009 as c_uint;
pub static BLEND_EQUATION_ALPHA: c_uint = 0x883D as c_uint;

/* BlendSubtract */
pub static FUNC_SUBTRACT: c_uint = 0x800A as c_uint;
pub static FUNC_REVERSE_SUBTRACT: c_uint = 0x800B as c_uint;

/* Separate Blend Functions */
pub static BLEND_DST_RGB: c_uint = 0x80C8 as c_uint;
pub static BLEND_SRC_RGB: c_uint = 0x80C9 as c_uint;
pub static BLEND_DST_ALPHA: c_uint = 0x80CA as c_uint;
pub static BLEND_SRC_ALPHA: c_uint = 0x80CB as c_uint;
pub static CONSTANT_COLOR: c_uint = 0x8001 as c_uint;
pub static ONE_MINUS_CONSTANT_COLOR: c_uint = 0x8002 as c_uint;
pub static CONSTANT_ALPHA: c_uint = 0x8003 as c_uint;
pub static ONE_MINUS_CONSTANT_ALPHA: c_uint = 0x8004 as c_uint;
pub static BLEND_COLOR: c_uint = 0x8005 as c_uint;

/* Errors. */
pub static NO_ERROR: c_uint = 0 as c_uint;
pub static INVALID_ENUM: c_uint = 0x0500 as c_uint;
@@ -332,6 +368,36 @@ pub fn bind_texture(target: GLenum, texture: GLuint) {
}
}

pub fn blend_color(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) {
unsafe {
ll::glBlendColor(red, green, blue, alpha);
}
}

pub fn blend_equation(mode: GLenum) {
unsafe {
ll::glBlendEquation(mode);
}
}

pub fn blend_equation_separate(mode_rgb: GLenum, mode_alpha: GLenum) {
unsafe {
ll::glBlendEquationSeparate(mode_rgb, mode_alpha);
}
}

pub fn blend_func(sfactor: GLenum, dfactor: GLenum) {
unsafe {
ll::glBlendFunc(sfactor, dfactor);
}
}

pub fn blend_func_separate(src_rgb: GLenum, dst_rgb: GLenum, src_alpha: GLenum, dst_alpha: GLenum) {
unsafe {
ll::glBlendFuncSeparate(src_rgb, dst_rgb, src_alpha, dst_alpha);
}
}

// FIXME: There should be some type-safe wrapper for this...
pub fn buffer_data<T>(target: GLenum, data: &[T], usage: GLenum) {
unsafe {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.