Struct webgl_rs::shader_program::WebGLRSProgram
source · pub struct WebGLRSProgram<'ctx> { /* private fields */ }
Expand description
The WebGLRSProgram
is part of the WebGL API and is a combination of two compiled WebGLShaders
consisting of a vertex shader and a fragment shader (both written in GLSL). These are then linked
into a usable program.
Implementations§
source§impl<'ctx> WebGLRSProgram<'ctx>
impl<'ctx> WebGLRSProgram<'ctx>
sourcepub fn delete(self)
pub fn delete(self)
Deletes this WebGLRSProgram
object. This method has no effect if the program has already been deleted.
sourcepub fn detach_shader(&self, shader: &WebGLRSShader<'_>)
pub fn detach_shader(&self, shader: &WebGLRSShader<'_>)
Detaches a previously attached WebGLRSShader
from this WebGLRSProgram
.
Arguments
shader
- shader to detach
sourcepub fn attach_shader(&self, shader: &WebGLRSShader<'_>)
pub fn attach_shader(&self, shader: &WebGLRSShader<'_>)
sourcepub fn bind_attrib_location(&self, index: u32, name: &str)
pub fn bind_attrib_location(&self, index: u32, name: &str)
Binds a generic vertex index to an attribute variable for this WebGLRSProgram
Arguments
index
- specifying the index of the generic vertex to bind.name
- specifying the name of the variable to bind to the generic vertex index. This name cannot start with “webgl_” or “webgl”, as these are reserved for use by WebGL.
sourcepub fn info_log(&self) -> String
pub fn info_log(&self) -> String
Returns the information log for this WebGLRSProgram
object. It contains errors that occurred during
failed linking or validation of this object.
sourcepub fn validate(&self)
pub fn validate(&self)
Validates this WebGLRSProgram
. Checks if it is successfully linked and if it can be used in the
current WebGL state.
sourcepub fn active_attrib(&self, index: u32) -> WebGLActiveInfo
pub fn active_attrib(&self, index: u32) -> WebGLActiveInfo
Returns a WebGLActiveInfo
object containing size, type, and name of a vertex attribute.
It is generally used when querying unknown uniforms either for debugging or generic library creation.
Arguments
index
- specifying the index of the vertex attribute to get.
sourcepub fn active_uniform(&self, index: u32) -> WebGLActiveInfo
pub fn active_uniform(&self, index: u32) -> WebGLActiveInfo
Returns a WebGLActiveInfo object containing size, type, and name of a uniform attribute.
It is generally used when querying unknown uniforms either for debugging or generic library creation.
Arguments
index
- specifying the index of the vertex attribute to get.
sourcepub fn attrib_location(&self, name: &str) -> u32
pub fn attrib_location(&self, name: &str) -> u32
Returns the location of an attribute variable in this WebGLRSProgram
.
Arguments
name
- specifying the name of the attribute variable whose location to get.
sourcepub fn uniform_location(&self, name: &str) -> WebGLRSUniformLocation<'_>
pub fn uniform_location(&self, name: &str) -> WebGLRSUniformLocation<'_>
Returns the location of a specific uniform variable which is part this WebGLRSProgram
.
The uniform variable is returned as a WebGLUniformLocation
object, which is an opaque identifier
used to specify where in the GPU’s memory that uniform variable is located.
Arguments
name
- specifying the name of the uniform variable whose location is to be returned. The name can’t have any whitespace in it, and you can’t use this function to get the location of any uniforms starting with the reserved string “gl_”, since those are internal to the WebGL layer.
sourcepub fn frag_data_location(&self, name: &str) -> i32
pub fn frag_data_location(&self, name: &str) -> i32
Returns the binding of color numbers to user-defined varying out variables.
Arguments
name
- specifying the name of the user-defined varying out variable.
sourcepub fn transform_feedback_varying(&self, index: u32) -> WebGLActiveInfo
pub fn transform_feedback_varying(&self, index: u32) -> WebGLActiveInfo
Returns information about varying variables from WebGLTransformFeedback buffers.
Arguments
index
- specifying the index of the varying variable whose information to retrieve.
sourcepub fn uniform_block_index(&self, uniform_block_name: &str) -> u32
pub fn uniform_block_index(&self, uniform_block_name: &str) -> u32
Retrieves the index of a uniform block in this WebGLRSProgram
.
Arguments
uniform_block_name
- specifying the name of the uniform block to whose index to retrieve.
sourcepub fn active_uniform_block_name(&self, uniform_block_index: u32) -> String
pub fn active_uniform_block_name(&self, uniform_block_index: u32) -> String
Retrieves the name of the active uniform block at a given index in this WebGLRSProgram
.
Arguments
uniform_block_index
- specifying the index of the uniform block to whose name to retrieve.
sourcepub fn assign_uniform_block_binding(
&self,
uniform_block_index: u32,
uniform_block_binding: u32
)
pub fn assign_uniform_block_binding(
&self,
uniform_block_index: u32,
uniform_block_binding: u32
)
Asigns binding points for active uniform blocks.
Arguments
uniform_block_index
- specifying the index of the active uniform block within the program.uniform_block_binding
- specifying the binding point to which to bind the uniform block.
sourcepub fn delete_status(&self) -> bool
pub fn delete_status(&self) -> bool
Indicates whether or not the program is flagged for deletion.
sourcepub fn link_status(&self) -> bool
pub fn link_status(&self) -> bool
Indicates whether or not the last link operation was successful.
sourcepub fn validate_status(&self) -> bool
pub fn validate_status(&self) -> bool
Indicates whether or not the last validation operation was successful.
sourcepub fn attached_shaders(&self) -> i32
pub fn attached_shaders(&self) -> i32
Returns the number of attached shaders to a program.
sourcepub fn active_attributes(&self) -> i32
pub fn active_attributes(&self) -> i32
Returns the number of active attribute variables to a program.
sourcepub fn active_uniforms(&self) -> i32
pub fn active_uniforms(&self) -> i32
Returns the number of active uniform variables to a program.
sourcepub fn transform_feedback_buffer_mode(&self) -> TransformFeedbackBufferMode
pub fn transform_feedback_buffer_mode(&self) -> TransformFeedbackBufferMode
Returns the buffer mode when transform feedback is active. May be SeparateAttribs
or InterleavedAttribs
.
sourcepub fn transform_feedback_varyings(&self) -> i32
pub fn transform_feedback_varyings(&self) -> i32
Returns the number of varying variables to capture in transform feedback mode.
pub fn active_uniform_blocks(&self) -> i32
Trait Implementations§
source§impl<'ctx> Clone for WebGLRSProgram<'ctx>
impl<'ctx> Clone for WebGLRSProgram<'ctx>
source§fn clone(&self) -> WebGLRSProgram<'ctx>
fn clone(&self) -> WebGLRSProgram<'ctx>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more