Handle errors from MakeCurrent and SwapBuffers

This commit is contained in:
Pierre Krieger 2015-06-16 10:15:31 +02:00
parent e48c853b9c
commit f6c26ec593
20 changed files with 123 additions and 62 deletions

View file

@ -1,3 +1,4 @@
use ContextError;
use CreationError;
use CreationError::OsError;
use BuilderAttribs;
@ -61,7 +62,7 @@ impl HeadlessContext {
}
impl GlContext for HeadlessContext {
unsafe fn make_current(&self) {
unsafe fn make_current(&self) -> Result<(), ContextError> {
self.context.makeCurrentContext();
gl::GenFramebuffersEXT(1, &mut framebuffer);
@ -78,6 +79,8 @@ impl GlContext for HeadlessContext {
if status != gl::FRAMEBUFFER_COMPLETE_EXT {
panic!("Error while creating the framebuffer");
}
Ok(())
}
fn is_current(&self) -> bool {
@ -96,7 +99,8 @@ impl GlContext for HeadlessContext {
symbol as *const libc::c_void
}
fn swap_buffers(&self) {
fn swap_buffers(&self) -> Result<(), ContextError> {
Ok(())
}
fn get_api(&self) -> ::Api {