Skip to content

Commit

Permalink
Add glCreateFramebuffers
Browse files Browse the repository at this point in the history
  • Loading branch information
chyyran committed Aug 26, 2024
1 parent 9000e31 commit 2150914
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ pub trait HasContext: __private::Sealed {

unsafe fn create_framebuffer(&self) -> Result<Self::Framebuffer, String>;

unsafe fn create_named_framebuffer(&self) -> Result<Self::Framebuffer, String>;

unsafe fn is_framebuffer(&self, framebuffer: Self::Framebuffer) -> bool;

unsafe fn create_query(&self) -> Result<Self::Query, String>;
Expand Down
7 changes: 7 additions & 0 deletions src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ impl HasContext for Context {
Ok(NativeFramebuffer(non_zero_gl_name(name)))
}

unsafe fn create_named_framebuffer(&self) -> Result<Self::Framebuffer, String> {
let gl = &self.raw;
let mut name = 0;
gl.CreateFramebuffers(1, &mut name);
Ok(NativeFramebuffer(non_zero_gl_name(name)))
}

unsafe fn is_framebuffer(&self, framebuffer: Self::Framebuffer) -> bool {
let gl = &self.raw;
gl.IsFramebuffer(framebuffer.0.get()) != 0
Expand Down
4 changes: 4 additions & 0 deletions src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,10 @@ impl HasContext for Context {
}
}

unsafe fn create_named_framebuffer(&self) -> Result<Self::Framebuffer, String> {
panic!("Named framebuffers are not supported");
}

unsafe fn is_framebuffer(&self, framebuffer: Self::Framebuffer) -> bool {
let framebuffers = self.framebuffers.borrow_mut();
if let Some(ref f) = framebuffers.get(framebuffer) {
Expand Down

0 comments on commit 2150914

Please sign in to comment.