pub struct Screen {}Expand description
The screen render target which is essential to get something on the screen (see the write function).
Implementations
sourceimpl Screen
impl Screen
sourcepub fn write<F: FnOnce() -> ThreeDResult<()>>(
context: &Context,
clear_state: ClearState,
render: F
) -> ThreeDResult<()>
pub fn write<F: FnOnce() -> ThreeDResult<()>>(
context: &Context,
clear_state: ClearState,
render: F
) -> ThreeDResult<()>
Call this function and make a render call (for example one of the draw functions on Program)
in the render closure to render something to the screen.
Before writing, the screen is cleared based on the given clear state.
sourcepub fn read_color(
context: &Context,
viewport: Viewport
) -> ThreeDResult<Vec<[u8; 4]>>
pub fn read_color(
context: &Context,
viewport: Viewport
) -> ThreeDResult<Vec<[u8; 4]>>
Returns the RGBA color values from the screen as a list of bytes (one byte for each color channel).
sourcepub fn read_depth(
context: &Context,
viewport: Viewport
) -> ThreeDResult<Vec<f32>>
pub fn read_depth(
context: &Context,
viewport: Viewport
) -> ThreeDResult<Vec<f32>>
Returns the depth values from the screen as a list of 32-bit floats. Only available on desktop.
sourcepub fn copy_from(
context: &Context,
color_texture: Option<&Texture2D>,
depth_texture: Option<&DepthTargetTexture2D>,
viewport: Viewport,
write_mask: WriteMask
) -> ThreeDResult<()>
pub fn copy_from(
context: &Context,
color_texture: Option<&Texture2D>,
depth_texture: Option<&DepthTargetTexture2D>,
viewport: Viewport,
write_mask: WriteMask
) -> ThreeDResult<()>
Copies the content of the color and depth texture to the specified viewport of this render target. Only copies the channels given by the write mask.
sourcepub fn copy_from_array(
context: &Context,
color_texture: Option<(&Texture2DArray, u32)>,
depth_texture: Option<(&DepthTargetTexture2DArray, u32)>,
viewport: Viewport,
write_mask: WriteMask
) -> ThreeDResult<()>
pub fn copy_from_array(
context: &Context,
color_texture: Option<(&Texture2DArray, u32)>,
depth_texture: Option<(&DepthTargetTexture2DArray, u32)>,
viewport: Viewport,
write_mask: WriteMask
) -> ThreeDResult<()>
Copies the content of the given layers of the color and depth array textures to the specified viewport of this render target. Only copies the channels given by the write mask.
Auto Trait Implementations
impl RefUnwindSafe for Screen
impl Send for Screen
impl Sync for Screen
impl Unpin for Screen
impl UnwindSafe for Screen
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more