#[repr(C)]pub struct GlShader {
pub program_id: GLuint,
pub gl_context: GlContextPtr,
pub run_destructor: bool,
}Fields§
§program_id: GLuint§gl_context: GlContextPtr§run_destructor: boolAUDIT: guards against a double-drop deleting the same GL program twice
(drop_in_place run twice on a byte-copied struct). Set true on
construction; the first drop clears it so a second drop is a no-op.
Implementations§
Source§impl GlShader
impl GlShader
Sourcepub fn new(
gl_context: &GlContextPtr,
vertex_shader: &str,
fragment_shader: &str,
) -> Result<Self, GlShaderCreateError>
pub fn new( gl_context: &GlContextPtr, vertex_shader: &str, fragment_shader: &str, ) -> Result<Self, GlShaderCreateError>
Compiles and creates a new OpenGL shader, created from a vertex and a fragment shader string.
If the shader fails to compile, the shader object gets automatically deleted, no cleanup necessary.
§Errors
Returns an error if the OpenGL implementation has no shader compiler, or if the vertex/fragment shader fails to compile or link.
Trait Implementations§
impl Eq for GlShader
Source§impl Ord for GlShader
impl Ord for GlShader
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Auto Trait Implementations§
impl !Send for GlShader
impl !Sync for GlShader
impl Freeze for GlShader
impl RefUnwindSafe for GlShader
impl Unpin for GlShader
impl UnsafeUnpin for GlShader
impl UnwindSafe for GlShader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more