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 EGL stuffs #67

Merged
merged 2 commits into from Dec 27, 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

Add GLES2 extension API bindings and some fixes.

  • Loading branch information
recrack authored and aydin.kim committed Dec 27, 2013
commit 66714e2e67397b0d5d836c2ae217dbd70c21f635
36 gl2.rs
@@ -365,6 +365,8 @@ pub type GLintptr = intptr_t;

pub type GLsizeiptr = ssize_t;

// gl2ext
pub type GLeglImageOES = *c_void;

// Helper functions

@@ -450,8 +452,9 @@ pub fn blend_func_separate(src_rgb: GLenum, dst_rgb: GLenum, src_alpha: GLenum,
glBlendFuncSeparate(src_rgb, dst_rgb, src_alpha, dst_alpha);
}
}

// FIXME: There should be some type-safe wrapper for this...
#[cfg(not(target_os="android"), not(target_os="macos"))]
#[cfg(not(target_os="android"), not(mac_10_6))]
pub fn buffer_data<T>(target: GLenum, data: &[T], usage: GLenum) {
unsafe {
glBufferData(target,
@@ -461,6 +464,18 @@ pub fn buffer_data<T>(target: GLenum, data: &[T], usage: GLenum) {
}
}

// FIXME: There should be some type-safe wrapper for this...
// FIXME: T is not working
#[cfg(target_os="android")]
pub fn buffer_data(target: GLenum, data: &[f32], usage: GLenum) {
unsafe {
glBufferData(target,
(data.len() * size_of::<f32>()) as GLsizeiptr,
to_ptr(data) as *GLvoid,
usage);
}
}

// 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]) {
@@ -1080,6 +1095,22 @@ pub fn viewport(x: GLint, y: GLint, width: GLsizei, height: GLsizei) {
}
}


#[cfg(target_os="android")]
pub fn egl_image_target_texture2d_oes(target: GLenum, image: GLeglImageOES) {
unsafe {
return glEGLImageTargetTexture2DOES(target, image);
}

}

#[cfg(target_os="android")]
pub fn egl_image_target_renderbuffer_storage_oes(target: GLenum, image: GLeglImageOES) {
unsafe {
return glEGLImageTargetRenderbufferStorageOES(target, image);
}
}

// Apple extensions
#[cfg(target_os="macos")]
pub mod apple {
@@ -1409,6 +1440,9 @@ pub fn glVertexAttribDivisor(indx: GLuint, divisor: GLuint);

pub fn glViewport(x: GLint, y: GLint, width: GLsizei, height: GLsizei);

#[cfg(target_os="android")]
pub fn glEGLImageTargetTexture2DOES(target: GLenum, image: GLeglImageOES);
pub fn glEGLImageTargetRenderbufferStorageOES(target: GLenum, image: GLeglImageOES);

}

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