Trait willow::Program [−][src]
pub trait Program: Sized { type AttrStruct: AttrStruct; fn create_internally(gl: &Context) -> Self; fn compile_shaders(&self, gl: &Context); fn link_shaders(&self, gl: &Context); fn apply_attrs(&self, context: &Context, buffer: &Buffer<Self::AttrStruct>); fn create(context: &Context) -> Self { ... } fn prepare_buffer(
context: &Context,
attrs: &[Self::AttrStruct],
usage: BufferDataUsage
) -> Buffer<Self::AttrStruct> { ... } fn draw_fully(
&self,
context: &Context,
mode: RenderPrimitiveType,
buffer: &Buffer<Self::AttrStruct>,
items: impl RangeBounds<usize>
) { ... } }
Expand description
Represents WebGL programs.
This type should only be implemented by the Program macro.
Associated Types
type AttrStruct: AttrStruct[src]
type AttrStruct: AttrStruct[src]The struct generated for storing attributes.
Always #[repr(C)].
Required methods
fn create_internally(gl: &Context) -> Self[src]
fn create_internally(gl: &Context) -> Self[src]Creates an instance of the type. Allocate necessary resources like gl.createShader().
fn compile_shaders(&self, gl: &Context)[src]
fn compile_shaders(&self, gl: &Context)[src]Compiles the vertex and fragment shaders.
fn link_shaders(&self, gl: &Context)[src]
fn link_shaders(&self, gl: &Context)[src]Attaches and links the vertex and fragment shaders.
fn apply_attrs(&self, context: &Context, buffer: &Buffer<Self::AttrStruct>)[src]
fn apply_attrs(&self, context: &Context, buffer: &Buffer<Self::AttrStruct>)[src]Applies the buffer ot the attributes in this program.
Provided methods
fn prepare_buffer(
context: &Context,
attrs: &[Self::AttrStruct],
usage: BufferDataUsage
) -> Buffer<Self::AttrStruct>[src]
fn prepare_buffer(
context: &Context,
attrs: &[Self::AttrStruct],
usage: BufferDataUsage
) -> Buffer<Self::AttrStruct>[src]Prepares a buffer with the attributes in the vec.
fn draw_fully(
&self,
context: &Context,
mode: RenderPrimitiveType,
buffer: &Buffer<Self::AttrStruct>,
items: impl RangeBounds<usize>
)[src]
fn draw_fully(
&self,
context: &Context,
mode: RenderPrimitiveType,
buffer: &Buffer<Self::AttrStruct>,
items: impl RangeBounds<usize>
)[src]Runs the program with the given attributes.