diff --git a/Cargo.toml b/Cargo.toml index 3d0f16b..69b3c7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "offscreen_gl_context" license = "MIT / Apache-2.0" -version = "0.8.2" +version = "0.8.3" authors = ["Emilio Cobos Álvarez ", "The Servo Project Developers"] description = "Creation and manipulation of HW accelerated offscreen rendering contexts in multiple platforms. Originally intended for the Servo project's WebGL implementation." repository = "https://github.com/emilio/rust-offscreen-rendering-context" diff --git a/src/gl_context.rs b/src/gl_context.rs index a58ddd6..d1876a1 100644 --- a/src/gl_context.rs +++ b/src/gl_context.rs @@ -48,7 +48,7 @@ impl GLContext try!(native_context.make_current()); let attributes = GLContextAttributes::any(); - let formats = GLFormats::detect(&attributes); + let formats = GLFormats::detect(&attributes, &*gl_); let limits = GLLimits::detect(&*gl_); Ok(GLContext { @@ -100,7 +100,7 @@ impl GLContext shared_with, dispatcher)); - context.formats = GLFormats::detect(&attributes); + context.formats = GLFormats::detect(&attributes, context.gl()); context.attributes = attributes; try!(context.init_offscreen(size, color_attachment_type)); diff --git a/src/gl_formats.rs b/src/gl_formats.rs index 42033f6..3dc2ecd 100644 --- a/src/gl_formats.rs +++ b/src/gl_formats.rs @@ -20,7 +20,7 @@ impl GLFormats { // FIXME: In linux with GLES2 texture attachments create INVALID_ENUM errors. // I suspect that it's because of texture formats, but I need time to debugit. #[cfg(not(target_os="android"))] - pub fn detect(attrs: &GLContextAttributes) -> GLFormats { + pub fn detect(attrs: &GLContextAttributes, _: &gl::Gl) -> GLFormats { if attrs.alpha { GLFormats { color_renderbuffer: gl::RGBA8, @@ -43,10 +43,10 @@ impl GLFormats { } #[cfg(target_os="android")] - pub fn detect(attrs: &GLContextAttributes) -> GLFormats { + pub fn detect(attrs: &GLContextAttributes, gl: &gl::Gl) -> GLFormats { // detect if the GPU supports RGB8 and RGBA8 renderbuffer/texture storage formats. // GL_ARM_rgba8 extension is similar to OES_rgb8_rgba8, but only exposes RGBA8. - let extensions = gl::get_string(gl::EXTENSIONS); + let extensions = gl.get_string(gl::EXTENSIONS); let extensions: Vec<&str> = extensions.split(&[',',' '][..]).collect(); let has_rgb8 = extensions.contains(&"GL_OES_rgb8_rgba8"); let has_rgba8 = has_rgb8 || extensions.contains(&"GL_ARM_rgba8");