base_ui/core/gl_context.rs
1use gl;
2
3pub struct GLContext;
4
5impl GLContext {
6 pub fn new(window: &super::Window) -> Self {
7 gl::load_with(|s| window.get_proc_address(s));
8
9 unsafe {
10 gl::Enable(gl::BLEND);
11 gl::BlendFunc(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA);
12 }
13
14 Self
15 }
16
17 pub fn clear(&self, r: f32, g: f32, b: f32, a: f32) {
18 unsafe {
19 gl::ClearColor(r, g, b, a);
20 gl::Clear(gl::COLOR_BUFFER_BIT);
21 }
22 }
23}