RenderingContext

Struct RenderingContext 

Source
pub struct RenderingContext<'gl> { /* private fields */ }

Implementations§

Source§

impl<'gl> RenderingContext<'gl>

Source

pub unsafe fn new() -> Self

§Safety

Must only be called on a thread where there is a current OpenGL context. The returned RenderingContext must only exist, while the OpenGL context is valid.

Source

pub fn set_clear_color(&mut self, (r, g, b, a): (f32, f32, f32, f32))

Examples found in repository?
examples/basic_app.rs (line 35)
34    fn init(ctx: &mut RenderingContext<'gl>) -> Result<Self, Self::Err> {
35        ctx.set_clear_color((1.0, 0.0, 1.0, 1.0));
36
37        Ok(Self)
38    }
Source

pub fn clear_color_buffer(&mut self)

Examples found in repository?
examples/basic_app.rs (line 41)
40    fn draw(&mut self, ctx: &mut RenderingContext<'gl>, _wnd: &Window) {
41        ctx.clear_color_buffer();
42    }
Source

pub fn create_buffer(&mut self) -> Buffer<'gl>

Source

pub fn create_buffers<const N: usize>(&mut self) -> [Buffer<'gl>; N]

Source

pub fn create_buffer_with_data<T: Copy>( &mut self, usage: BufferUsage, data: &[T], ) -> Buffer<'gl>

Source

pub fn create_vertex_array<'a>( &mut self, desc: impl AsRef<VertexArrayDesc<'gl, 'a>>, ) -> VertexArray<'gl>
where 'gl: 'a,

Source

pub fn create_texture( &mut self, size: (u32, u32), internal_format: InternalFormat, ) -> Texture<'gl>

Source

pub fn create_shader_stage( &mut self, kind: ShaderStageKind, source: impl AsRef<str>, ) -> Result<ShaderStage<'gl>, ShaderStageError>

Source

pub fn create_shader_stage_vertex( &mut self, source: impl AsRef<str>, ) -> Result<ShaderStage<'gl>, ShaderStageError>

Source

pub fn create_shader_stage_fragment( &mut self, source: impl AsRef<str>, ) -> Result<ShaderStage<'gl>, ShaderStageError>

Source

pub fn create_shader_stage_geometry( &mut self, source: impl AsRef<str>, ) -> Result<ShaderStage<'gl>, ShaderStageError>

Source

pub fn create_shader_stage_compute( &mut self, source: impl AsRef<str>, ) -> Result<ShaderStage<'gl>, ShaderStageError>

Source

pub fn create_shader<'a>( &mut self, stages: &[impl AsRef<ShaderStage<'a>>], ) -> Result<Shader<'gl>, ShaderError>

Auto Trait Implementations§

§

impl<'gl> Freeze for RenderingContext<'gl>

§

impl<'gl> RefUnwindSafe for RenderingContext<'gl>

§

impl<'gl> Send for RenderingContext<'gl>

§

impl<'gl> Sync for RenderingContext<'gl>

§

impl<'gl> Unpin for RenderingContext<'gl>

§

impl<'gl> UnwindSafe for RenderingContext<'gl>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.