Struct Framebuffer

Source
pub struct Framebuffer<B, D, CS, DS>
where B: ?Sized + FramebufferBackend<D>, D: Dimensionable, CS: ColorSlot<B, D>, DS: DepthStencilSlot<B, D>,
{ /* private fields */ }
Expand description

Typed framebuffers.

§Parametricity

Implementations§

Source§

impl<B, D, CS, DS> Framebuffer<B, D, CS, DS>
where B: ?Sized + FramebufferBackend<D>, D: Dimensionable, CS: ColorSlot<B, D>, DS: DepthStencilSlot<B, D>,

Source

pub fn new<C>( ctx: &mut C, size: D::Size, mipmaps: usize, sampler: Sampler, ) -> Result<Self, FramebufferError>
where C: GraphicsContext<Backend = B>,

Create a new Framebuffer.

The mipmaps argument allows to pass the number of extra precision layers the texture will be created with. A precision layer contains the same image as the base layer but in a lower resolution. Currently, the way the resolution is computed depends on the backend, but it is safe to assume that it’s logarithmic in base 2 — i.e. at each layer depth, the resolution is divided by 2 on each axis.

§Errors

It is possible that the Framebuffer cannot be created. The FramebufferError provides the reason why.

§Notes

You might be interested in the GraphicsContext::new_framebuffer function instead, which is the exact same function, but benefits from more type inference (based on &mut C).

Source

pub fn size(&self) -> D::Size

Get the size of the framebuffer.

Source

pub fn color_slot(&mut self) -> &mut CS::ColorTextures

Access the carried color slot’s texture(s).

Source

pub fn depth_stencil_slot(&mut self) -> &mut DS::DepthStencilTexture

Access the carried depth/stencil slot’s texture.

Source

pub fn into_slots(self) -> (CS::ColorTextures, DS::DepthStencilTexture)

Consume this framebuffer and return the carried slots’ texture(s).

Source

pub fn into_color_slot(self) -> CS::ColorTextures

Consume this framebuffer and return the carried ColorSlot::ColorTextures.

Source

pub fn into_depth_stencil_slot(self) -> DS::DepthStencilTexture

Consume this framebuffer and return the carried DepthStencilSlot::DepthStencilTexture.

Source§

impl<B> Framebuffer<B, Dim2, (), ()>

Source

pub fn back_buffer<C>( ctx: &mut C, size: <Dim2 as Dimensionable>::Size, ) -> Result<Self, FramebufferError>
where C: GraphicsContext<Backend = B>,

Get the back buffer from the input context and the required resolution.

Auto Trait Implementations§

§

impl<B, D, CS, DS> Freeze for Framebuffer<B, D, CS, DS>

§

impl<B, D, CS, DS> RefUnwindSafe for Framebuffer<B, D, CS, DS>

§

impl<B, D, CS, DS> Send for Framebuffer<B, D, CS, DS>
where <B as Framebuffer<D>>::FramebufferRepr: Send, <CS as ColorSlot<B, D>>::ColorTextures: Send, <DS as DepthStencilSlot<B, D>>::DepthStencilTexture: Send, B: ?Sized,

§

impl<B, D, CS, DS> Sync for Framebuffer<B, D, CS, DS>
where <B as Framebuffer<D>>::FramebufferRepr: Sync, <CS as ColorSlot<B, D>>::ColorTextures: Sync, <DS as DepthStencilSlot<B, D>>::DepthStencilTexture: Sync, B: ?Sized,

§

impl<B, D, CS, DS> Unpin for Framebuffer<B, D, CS, DS>

§

impl<B, D, CS, DS> UnwindSafe for Framebuffer<B, D, CS, DS>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.