equal
deleted
inserted
replaced
1 use integral_geometry::Rect; |
1 use integral_geometry::Rect; |
2 |
2 |
3 use std::{ffi, ffi::CString, mem, ptr, slice}; |
3 use std::{ffi, ffi::CString, mem, ptr, slice}; |
|
4 |
|
5 #[derive(Default)] |
|
6 pub struct PipelineState { |
|
7 blending: bool, |
|
8 } |
|
9 |
|
10 impl PipelineState { |
|
11 pub fn new() -> Self { |
|
12 Self::default() |
|
13 } |
|
14 |
|
15 pub fn with_blend(mut self) -> Self { |
|
16 unsafe { |
|
17 gl::Enable(gl::BLEND); |
|
18 gl::BlendFunc(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA); |
|
19 } |
|
20 self.blending = true; |
|
21 self |
|
22 } |
|
23 } |
|
24 |
|
25 impl Drop for PipelineState { |
|
26 fn drop(&mut self) { |
|
27 if self.blending { |
|
28 unsafe { gl::Disable(gl::BLEND) } |
|
29 } |
|
30 } |
|
31 } |
4 |
32 |
5 #[derive(Debug)] |
33 #[derive(Debug)] |
6 pub struct Texture2D { |
34 pub struct Texture2D { |
7 pub handle: u32, |
35 pub handle: u32, |
8 } |
36 } |