#[non_exhaustive]pub struct Frame<'instance> { /* private fields */ }Implementations§
Source§impl<'instance> Frame<'instance>
impl<'instance> Frame<'instance>
Sourcepub fn select_render_target<T: Target>(
&mut self,
target: &'instance T,
) -> Result<()>
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.
Sourcepub fn buffer_info(&self) -> Option<Info>
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.
Sourcepub fn set_buffer_info(&mut self, buffer_info: &Info)
pub fn set_buffer_info(&mut self, buffer_info: &Info)
Set the buffer info to use for for the following draw calls.
Sourcepub fn attr_info(&self) -> Option<Info>
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.
Sourcepub fn set_attr_info(&mut self, attr_info: &Info)
pub fn set_attr_info(&mut self, attr_info: &Info)
Set the attribute info to use for any following draw calls.
Sourcepub fn draw_arrays(&mut self, primitive: Primitive, vbo_data: Slice<'instance>)
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).
Sourcepub fn draw_elements<I: Index>(
&mut self,
primitive: Primitive,
vbo_data: Slice<'instance>,
indices: &Indices<'instance, I>,
)
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).
Sourcepub fn bind_program(&mut self, program: &'instance Program)
pub fn bind_program(&mut self, program: &'instance Program)
Use the given shader::Program for the following draw calls.
Sourcepub fn bind_light_env(&mut self, env: Option<Pin<&'instance mut LightEnv>>)
pub fn bind_light_env(&mut self, env: Option<Pin<&'instance mut LightEnv>>)
Binds a LightEnv for the following draw calls.
Sourcepub fn bind_vertex_uniform(&mut self, index: Index, uniform: impl Into<Uniform>)
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);Sourcepub fn bind_geometry_uniform(
&mut self,
index: Index,
uniform: impl Into<Uniform>,
)
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);Sourcepub fn set_texenvs(&mut self, texenvs: &[TexEnv])
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]);Sourcepub fn bind_texture(&mut self, index: Index, texture: &'instance Texture)
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.