Function cgl_rs::graphics::widgets::flush

source ·
pub fn flush() -> bool
Expand description

Flushes all the vertices added to the current batch.

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(); // 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();