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

Add bindings for glGetString #23

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

17 gl2.rs
@@ -14,6 +14,7 @@ use core::libc::types::common::c99::*;
use core::cast::{reinterpret_cast, transmute};
use core::ptr::to_unsafe_ptr;
use core::str::{as_c_str, from_bytes};
use core::str::raw::from_c_str;
use core::sys::size_of;
use core::vec::from_elem;
use core::vec::raw::to_ptr;
@@ -216,6 +217,11 @@ pub static NOTEQUAL: c_uint = 0x0205 as c_uint;
pub static GEQUAL: c_uint = 0x0206 as c_uint;
pub static ALWAYS: c_uint = 0x0207 as c_uint;

pub static VENDOR: c_uint = 0x1F00 as c_uint;
pub static RENDERER: c_uint = 0x1F01 as c_uint;
pub static VERSION: c_uint = 0x1F02 as c_uint;
pub static EXTENSIONS: c_uint = 0x1F03 as c_uint;

/* Shader Source */
pub static COMPILE_STATUS: c_uint = 0x8B81 as c_uint;
pub static INFO_LOG_LENGTH: c_uint = 0x8B84 as c_uint;
@@ -680,6 +686,17 @@ pub fn get_shader_info_log(shader: GLuint) -> ~str {
}
}

pub fn get_string(which: GLenum) -> ~str {
unsafe {
let llstr = ll::glGetString(which);
if !ptr::is_null(llstr) {
return from_c_str(llstr as *c_char);
} else {
return ~"";
}
}
}

pub fn get_shader_iv(shader: GLuint, pname: GLenum) -> GLint {
unsafe {
let result: GLint = 0 as GLint;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.