Skip to content

Commit

Permalink
Auto merge of #182 - ArturKovacs:fix-181, r=jdm
Browse files Browse the repository at this point in the history
Fix for the offscreen example not working on Windows.

Partially addresses #181.

Note that after this fix, the example still doesn't halt but it finishes the main function successfully and produces the png with the colorful triangle.
  • Loading branch information
bors-servo authored Jun 10, 2020
2 parents 6e9b3c7 + eb2f457 commit 33221cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion surfman/examples/offscreen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,17 @@ fn main() {
}).unwrap();
device.bind_surface_to_context(&mut context, surface).unwrap();

gl::load_with(|symbol_name| device.get_proc_address(&context, symbol_name));
device.make_context_current(&context).unwrap();
gl::load_with(|symbol_name| device.get_proc_address(&context, symbol_name));

let mut pixels: Vec<u8> =
vec![0; FRAMEBUFFER_WIDTH as usize * FRAMEBUFFER_HEIGHT as usize * 4];
let tri_vertex_array = TriVertexArray::new(device.gl_api(),
device.surface_gl_texture_target());

unsafe {
let surface_info = device.context_surface_info(&context).unwrap().unwrap();
gl::BindFramebuffer(gl::FRAMEBUFFER, surface_info.framebuffer_object);
gl::Viewport(0, 0, FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT); ck();
gl::ClearColor(0.0, 0.0, 0.0, 1.0); ck();
gl::Clear(gl::COLOR_BUFFER_BIT); ck();
Expand Down

0 comments on commit 33221cd

Please sign in to comment.