offscreen_gl_context 0.25.1

Creation and manipulation of HW accelerated offscreen rendering contexts in multiple platforms. Originally intended for the Servo project's WebGL implementation.
Documentation
use sparkle::gl::{GLint};

#[allow(unused_imports)]
use crate::GLFeature;

/// This is a cross-platform struct, that every GLContext implementation
/// should have under the field `capabilities`, as a public field
/// This should allow us to know the capabilities of a given
/// GLContext without repeating the same code over and over
#[derive(Copy, Clone, Debug)]
pub struct GLContextCapabilities {
    // max antialising samples, 0 if no antialising supported
    pub max_samples: GLint,
}

impl GLContextCapabilities {
    #[allow(unused_mut)]
    pub fn detect() -> GLContextCapabilities {
        let mut capabilities = GLContextCapabilities {
            max_samples: 0,
        };


        // FIXME(ecoal95): uncomment me when we have cross-system constants
        // if GLFeature::is_supported(GLFeature::FramebufferMultisample) {
            // unsafe { gl::GetIntegerv(gl::MAX_SAMPLES, &mut capabilities.max_samples as *mut GLint); };
        // }

        capabilities
    }
}