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

Update for android port. #66

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

44 gl2.rs
@@ -365,6 +365,16 @@ pub type GLintptr = intptr_t;

pub type GLsizeiptr = ssize_t;

// GL info
pub static GL_VENDOR: c_uint = 0x1F00;

This comment has been minimized.

Copy link
@metajack

metajack Dec 27, 2013

Contributor

These need to omit the GL_ prefix like the other statics.

pub static GL_RENDERER: c_uint = 0x1F01;
pub static GL_VERSION: c_uint = 0x1F02;
pub static GL_EXTENSIONS: c_uint = 0x1F03;

pub static GL_COLOR_BUFFER_BIT: c_uint = 0x00004000;

// gl2ext
pub type GLeglImageOES = *c_void;

// Helper functions

@@ -450,8 +460,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 +472,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 +1103,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 +1448,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);

}

4 lib.rs
@@ -7,6 +7,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[link(name = "opengles",
vers = "0.1")];
#[crate_type = "lib"];

extern mod std;

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