Struct Frame

Source
#[non_exhaustive]
pub struct Frame<'instance> { /* private fields */ }

Implementations§

Source§

impl<'instance> Frame<'instance>

Source

pub fn select_render_target<T: Target>( &mut self, target: &'instance T, ) -> Result<()>

Select the given render target for the following draw calls.

§Errors

Fails if the given target cannot be used for drawing.

Source

pub fn buffer_info(&self) -> Option<Info>

Get the buffer info being used, if it exists.

§Notes

The resulting buffer::Info is copied (and not taken) from the one currently in use.

Source

pub fn set_buffer_info(&mut self, buffer_info: &Info)

Set the buffer info to use for for the following draw calls.

Source

pub fn attr_info(&self) -> Option<Info>

Get the attribute info being used, if it exists.

§Notes

The resulting attrib::Info is copied (and not taken) from the one currently in use.

Source

pub fn set_attr_info(&mut self, attr_info: &Info)

Set the attribute info to use for any following draw calls.

Source

pub fn draw_arrays(&mut self, primitive: Primitive, vbo_data: Slice<'instance>)

Render primitives from the current vertex array buffer.

§Panics

Panics if no shader program was bound (see Frame::bind_program).

Source

pub fn draw_elements<I: Index>( &mut self, primitive: Primitive, vbo_data: Slice<'instance>, indices: &Indices<'instance, I>, )

Draws the vertices in buf indexed by indices.

§Panics

Panics if no shader program was bound (see Frame::bind_program).

Source

pub fn bind_program(&mut self, program: &'instance Program)

Use the given shader::Program for the following draw calls.

Source

pub fn bind_light_env(&mut self, env: Option<Pin<&'instance mut LightEnv>>)

Binds a LightEnv for the following draw calls.

Source

pub fn bind_vertex_uniform(&mut self, index: Index, uniform: impl Into<Uniform>)

Bind a uniform to the given index in the vertex shader for the next draw call.

§Panics

Panics if no shader program was bound (see Frame::bind_program).

§Example
let idx = uniform::Index::from(0);
let mtx = Matrix4::identity();
instance.bind_vertex_uniform(idx, &mtx);
Source

pub fn bind_geometry_uniform( &mut self, index: Index, uniform: impl Into<Uniform>, )

Bind a uniform to the given index in the geometry shader for the next draw call.

§Panics

Panics if no shader program was bound (see Frame::bind_program).

§Example
let idx = uniform::Index::from(0);
let mtx = Matrix4::identity();
instance.bind_geometry_uniform(idx, &mtx);
Source

pub fn set_texenvs(&mut self, texenvs: &[TexEnv])

Set up to 6 stages of TexEnv to use. If more than 6 stages are provided, the 7th onwards will be ignored. Retrieve the TexEnv for the given stage, initializing it first if necessary.

§Example
let stage0 =
    texenv::TexEnv::new().src(texenv::Mode::BOTH, texenv::Source::PrimaryColor, None, None);
let texenv0 = frame.set_texenvs([stage0]);
Source

pub fn bind_texture(&mut self, index: Index, texture: &'instance Texture)

Bind the given [Texture] to the specified texture::Unit, which should correspond to a source or destination texture configured in the TexEnv.

Source

pub fn set_cull_face(&mut self, cull: CullMode)

Trait Implementations§

Source§

impl Drop for Frame<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'instance> Freeze for Frame<'instance>

§

impl<'instance> RefUnwindSafe for Frame<'instance>

§

impl<'instance> !Send for Frame<'instance>

§

impl<'instance> !Sync for Frame<'instance>

§

impl<'instance> Unpin for Frame<'instance>

§

impl<'instance> !UnwindSafe for Frame<'instance>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.