pub fn flush_if_required() -> bool
Expand description

Flushes all the vertices added to the current batch if required.

Returns

Returns true if the vertices were successfully flushed, otherwise returns false

Example

cgl_rs::init();
let mut window = cgl_rs::Window::new("CGL Window", 800, 600).unwrap();
cgl_rs::graphics::init();
cgl_rs::graphics::widgets::init();
 
while !window.should_close() {
    // bind framebuffers, etc.
    cgl_rs::graphics::widgets::begin();
        // draw widgets here
    cgl_rs::graphics::widgets::flush_if_required(); // you could also check if the function returns true
    cgl_rs::graphics::widgets::end();
    // update window, swap buffers, etc.
    break; // for testing purposes
}
 
cgl_rs::graphics::widgets::shutdown();
cgl_rs::graphics::shutdown();
window.destroy();
cgl_rs::shutdown();