Struct glitter::context::framebuffer_context::FramebufferBuilder
[−]
[src]
pub struct FramebufferBuilder<'a, C> where
C: FramebufferContext, { /* fields omitted */ }
Provides a safe interface for building a framebuffer object that
is checked to be framebuffer-complete. A FramebufferBuilder
can
be created using the gl.build_framebuffer
method.
Note
The current implementation of FramebufferBuilder
uses heap-allocation
during construction. This should be fixed in a future release, but
consider falling back to the more direct gl.gen_framebuffer
if this ends
up being problematic.
Methods
impl<'a, C> FramebufferBuilder<'a, C> where
C: FramebufferContext,
[src]
C: FramebufferContext,
pub fn texture_2d(
self,
attachment: FramebufferAttachment,
texture: &'a mut Texture2d,
level: i32
) -> Self
[src]
self,
attachment: FramebufferAttachment,
texture: &'a mut Texture2d,
level: i32
) -> Self
Add a 2D texture (at the mipmap level specified by level
) to the
framebuffer's attachment point.
Failures
level
should be 0, or unwrapping the framebuffer will fail.
Note
Currently, only Texture2d
textures are supported using a FramebufferBuilder
. To bind a different
type of texture, use gl.framebuffer_texture_2d
on an existing framebuffer object instead (generated either with
a FramebufferBuilder
or with gl.gen_framebuffer
).
pub fn renderbuffer(
self,
attachment: FramebufferAttachment,
renderbuffer: &'a mut Renderbuffer
) -> Self
[src]
self,
attachment: FramebufferAttachment,
renderbuffer: &'a mut Renderbuffer
) -> Self
Add a renderbuffer to the framebuffer's attachment point.
pub fn try_unwrap(self) -> Result<Framebuffer, GLError>
[src]
Create and return a framebuffer with the specified options, or return an error.
Failures
If the resulting framebuffer is not framebuffer-complete, an error will be returned.
Panics
This function will panic if an OpenGL error was generated with debug assertions enabled.
pub fn unwrap(self) -> Framebuffer
[src]
Create and return a framebuffer with the specified options, or panic.
Panics
This function will panic if the resulting framebuffer is not framebuffer-complete or an OpenGL error was generated with debug assertions enabled.