fn enable_gl_debugging(gl: &gl::Gl) {
    let mut flags = 0;
    unsafe {
        gl.GetIntegerv(gl::CONTEXT_FLAGS, &mut flags);
    }

    // Only set the debugging options if debugging enabled on the context
    if flags as u32 & gl::CONTEXT_FLAG_DEBUG_BIT == 0 {
        return;
    }

    unsafe {
        // enables debug output
        gl.Enable(gl::DEBUG_OUTPUT);

        // ensure that debugging messages are only output on the main thread
        // ensures that the log function is called in the same order that the
        // messages are generated
        gl.Enable(gl::DEBUG_OUTPUT_SYNCHRONOUS);

        // set the debug call back, with no context pointer
        gl.DebugMessageCallback(Some(gl_debug_log), std::ptr::null());

        // tell the driver that we want all possible debug messages
        gl.DebugMessageControl(
            gl::DONT_CARE,
            gl::DONT_CARE,
            gl::DONT_CARE,
            0,
            std::ptr::null(),
            gl::TRUE,
        );
    }
}
/// attach console print debugging to the provided OpenGL Context
attach console print debugging to the provided OpenGL Context
attach console print debugging to the provided OpenGL Context
fn enable_gl_debugging(gl: &gl::Gl) {
    let mut flags = 0;
    unsafe {
        gl.GetIntegerv(gl::CONTEXT_FLAGS, &mut flags);
    }
    // Only set the debugging options if debugging enabled on the context
    if flags as u32 & gl::CONTEXT_FLAG_DEBUG_BIT == 0 {
        return;
    }
    unsafe {
        // enables debug output
        gl.Enable(gl::DEBUG_OUTPUT);
        // ensure that debugging messages are only output on the main thread
        // ensures that the log function is called in the same order that the
        // messages are generated
        gl.Enable(gl::DEBUG_OUTPUT_SYNCHRONOUS);
        // set the debug call back, with no context pointer
        gl.DebugMessageCallback(Some(gl_debug_log), std::ptr::null());
        // tell the driver that we want all possible debug messages
        gl.DebugMessageControl(
            gl::DONT_CARE,
            gl::DONT_CARE,
            gl::DONT_CARE,
            0,
            std::ptr::null(),
            gl::TRUE,
        );
    }
}
fn enable_gl_debugging ( gl : & gl :: Gl ) { let mut flags = 0 ; unsafe { gl . GetIntegerv ( gl :: CONTEXT_FLAGS , & mut flags ) ; } // Only set the debugging options if debugging enabled on the context if flags as u32 & gl :: CONTEXT_FLAG_DEBUG_BIT == 0 { return ; } unsafe { // enables debug output gl . Enable ( gl :: DEBUG_OUTPUT ) ; // ensure that debugging messages are only output on the main thread // ensures that the log function is called in the same order that the // messages are generated gl . Enable ( gl :: DEBUG_OUTPUT_SYNCHRONOUS ) ; // set the debug call back, with no context pointer gl . DebugMessageCallback ( Some ( gl_debug_log ) , std :: ptr :: null ( ) ) ; // tell the driver that we want all possible debug messages gl . DebugMessageControl ( gl :: DONT_CARE , gl :: DONT_CARE , gl :: DONT_CARE , 0 , std :: ptr :: null ( ) , gl :: TRUE , ) ; } }
attach console print debugging to the provided OpenGL Context
attach console print debugging to the provided OpenGL Context
gl
&gl::Gl
gl
&gl::Gl