autocommit 2022-04-28 19:49:51 CEST
This commit is contained in:
parent
bd63f3f5f1
commit
1242a6c1e1
31 changed files with 707 additions and 64 deletions
|
|
@ -1,6 +1,8 @@
|
|||
use {
|
||||
crate::render::{
|
||||
egl::image::EglImage, gl::texture::GlTexture, RenderContext, RenderError, Texture,
|
||||
egl::image::EglImage,
|
||||
gl::{render_buffer::GlRenderBuffer, texture::GlTexture},
|
||||
Framebuffer, RenderContext, RenderError, Texture,
|
||||
},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
|
@ -25,4 +27,15 @@ impl Image {
|
|||
gl: GlTexture::import_img(&self.ctx.ctx, &self.gl)?,
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn to_framebuffer(&self) -> Result<Rc<Framebuffer>, RenderError> {
|
||||
self.ctx.ctx.with_current(|| unsafe {
|
||||
let rb = GlRenderBuffer::from_image(&self.gl, &self.ctx.ctx)?;
|
||||
let fb = rb.create_framebuffer()?;
|
||||
Ok(Rc::new(Framebuffer {
|
||||
ctx: self.ctx.clone(),
|
||||
gl: fb,
|
||||
}))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue