pub struct GlShader {
pub program_id: GLuint,
pub gl_context: Rc<dyn Gl>,
}
Fields§
§program_id: GLuint
§gl_context: Rc<dyn Gl>
Implementations§
Source§impl GlShader
impl GlShader
Sourcepub fn new(
gl_context: Rc<dyn Gl>,
vertex_shader: &str,
fragment_shader: &str,
) -> Result<Self, GlShaderCreateError>
pub fn new( gl_context: Rc<dyn Gl>, 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.
Sourcepub fn draw<T: VertexLayoutDescription>(
&mut self,
buffers: &[(Rc<VertexBuffer<T>>, Vec<Uniform>)],
clear_color: Option<ColorU>,
texture_size: LogicalSize,
) -> Texture
pub fn draw<T: VertexLayoutDescription>( &mut self, buffers: &[(Rc<VertexBuffer<T>>, Vec<Uniform>)], clear_color: Option<ColorU>, texture_size: LogicalSize, ) -> Texture
Draws vertex buffers, index buffers + uniforms to the currently bound framebuffer
NOTE: FrameBuffer::bind()
and VertexBuffer::bind()
have to be called first!
Trait Implementations§
Source§impl Ord for GlShader
impl Ord for GlShader
Source§impl PartialOrd for GlShader
impl PartialOrd for GlShader
impl Eq for GlShader
Auto Trait Implementations§
impl Freeze for GlShader
impl !RefUnwindSafe for GlShader
impl !Send for GlShader
impl !Sync for GlShader
impl Unpin 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