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

Current #34

Closed
wants to merge 2 commits into from
Closed

Current #34

Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

android specific adaptation

  • Loading branch information
yichoi committed May 11, 2013
commit b787691a7aa8f5b2ac2e968f0d9693e17dc77322
38 gl2.rs
@@ -30,6 +30,11 @@ extern mod linkhack { }
#[cfg(target_os = "linux")]
extern mod linkhack { }

#[nolink]
#[link_args="-lGLESv2"]
#[cfg(target_os = "android")]
extern mod linkhack { }

This comment has been minimized.

Copy link
@jeaye

jeaye May 16, 2013

Contributor

This syntax has been removed in the latest incoming.


// Constants

/* BeginMode */
@@ -836,6 +841,7 @@ pub fn shader_source(shader: GLuint, strings: &[~[u8]]) {
}

// FIXME: Does not verify buffer size -- unsafe!
#[cfg(not(target_os = "android"))]
pub fn tex_image_2d(target: GLenum,
level: GLint,
internal_format: GLint,
@@ -862,6 +868,38 @@ pub fn tex_image_2d(target: GLenum,
}
}

#[cfg(target_os = "android")]
pub fn tex_image_2d(target: GLenum,
level: GLint,
internal_format: GLint,
width: GLsizei,
height: GLsizei,
border: GLint,
format: GLenum,
ty: GLenum,
opt_data: Option<&[u8]>) {
match opt_data {
Some(data) => {
unsafe {
//opengles has only RGB colorspace, but now we are using BRG color space. GL2ext has BGR space but I guess freeglut in android doesn't support gl2 extension.
let mut data_ = data.to_owned();
for uint::range(0, data_.len()) |i| {
if i % 4 == 0 { data_[i] <-> data_[i+2]; }
}
let pdata = transmute(to_ptr(data_));
ll::glTexImage2D(target, level, internal_format, width, height, border, format, ty,
pdata);
}
}
None => {
unsafe {
ll::glTexImage2D(target, level, internal_format, width, height, border, format, ty,
ptr::null());
}
}
}
}

// FIXME: Does not verify buffer size -- unsafe!
pub fn tex_sub_image_2d(target: GLenum,
level: GLint,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.