Skip to main content

Context

Struct Context 

Source
pub struct Context { /* private fields */ }

Implementations§

Source§

impl Context

Source

pub fn register(gl: Gl) -> Self

Source

pub fn from_webgl2_context(gl: Gl) -> Self

Source

pub fn from_context_id(context_id: ContextId) -> Option<Self>

Source

pub fn current() -> Option<Self>

Source

pub const fn id(self) -> ContextId

Source

pub fn make_current(&self) -> bool

Source

pub fn webgl2_context(&self) -> Gl

Source

pub fn create_buffer(&self) -> Option<Buffer>

Source

pub fn bind_buffer(&self, target: u32, buffer: Option<Buffer>)

Source

pub fn bind_buffer_base(&self, target: u32, index: u32, buffer: Option<Buffer>)

Source

pub fn bind_buffer_range( &self, target: u32, index: u32, buffer: Option<Buffer>, offset: i32, size: i32, )

Source

pub fn get_buffer_sub_data( &self, target: u32, src_byte_offset: i32, dst_data: &mut [u8], )

Source

pub fn delete_buffer(&self, buffer: Buffer)

Source

pub fn create_framebuffer(&self) -> Option<Framebuffer>

Source

pub fn bind_framebuffer(&self, target: u32, framebuffer: Option<Framebuffer>)

Source

pub fn delete_framebuffer(&self, framebuffer: Framebuffer)

Source

pub fn create_program(&self) -> Option<Program>

Source

pub fn use_program(&self, program: Option<Program>)

Source

pub fn delete_program(&self, program: Program)

Source

pub fn attach_shader(&self, program: Program, shader: Shader)

Source

pub fn detach_shader(&self, program: Program, shader: Shader)

Source

pub fn get_attrib_location(&self, program: Program, name: &str) -> i32

Source

pub fn get_uniform_block_index(&self, program: Program, name: &str) -> u32

Source

pub fn uniform_block_binding( &self, program: Program, uniform_block_index: u32, uniform_block_binding: u32, )

Source

pub fn active_uniform_block_name( &self, program: Program, uniform_block_index: u32, ) -> Option<String>

Source

pub fn active_uniform_block_parameter( &self, program: Program, uniform_block_index: u32, pname: u32, ) -> Result<JsValue, JsValue>

Source

pub fn transform_feedback_varyings( &self, program: Program, varyings: &[&str], buffer_mode: u32, )

Source

pub fn create_query(&self) -> Option<Query>

Source

pub fn delete_query(&self, query: Query)

Source

pub fn create_renderbuffer(&self) -> Option<Renderbuffer>

Source

pub fn bind_renderbuffer(&self, target: u32, renderbuffer: Option<Renderbuffer>)

Source

pub fn delete_renderbuffer(&self, renderbuffer: Renderbuffer)

Source

pub fn create_sampler(&self) -> Option<Sampler>

Source

pub fn bind_sampler(&self, unit: u32, sampler: Option<Sampler>)

Source

pub fn delete_sampler(&self, sampler: Sampler)

Source

pub fn create_shader(&self, shader_type: u32) -> Option<Shader>

Source

pub fn shader_source(&self, shader: Shader, source: &str)

Source

pub fn compile_shader(&self, shader: Shader)

Source

pub fn delete_shader(&self, shader: Shader)

Source

pub fn create_texture(&self) -> Option<Texture>

Source

pub fn bind_texture(&self, target: u32, texture: Option<Texture>)

Source

pub fn delete_texture(&self, texture: Texture)

Source

pub fn copy_tex_image_2d( &self, target: u32, level: i32, internal_format: u32, x: i32, y: i32, width: i32, height: i32, border: i32, )

Source

pub fn tex_image_3d( &self, target: u32, level: i32, internal_format: i32, width: i32, height: i32, depth: i32, border: i32, format: u32, ty: u32, pixels: Option<&[u8]>, ) -> Result<(), JsValue>

Source

pub fn tex_sub_image_3d( &self, target: u32, level: i32, x_offset: i32, y_offset: i32, z_offset: i32, width: i32, height: i32, depth: i32, format: u32, ty: u32, pixels: Option<&[u8]>, ) -> Result<(), JsValue>

Source

pub fn tex_storage_3d( &self, target: u32, levels: i32, internal_format: u32, width: i32, height: i32, depth: i32, )

Source

pub fn create_transform_feedback(&self) -> Option<TransformFeedback>

Source

pub fn bind_transform_feedback( &self, target: u32, transform_feedback: Option<TransformFeedback>, )

Source

pub fn is_transform_feedback( &self, transform_feedback: TransformFeedback, ) -> bool

Source

pub fn begin_transform_feedback(&self, primitive_mode: u32)

Source

pub fn end_transform_feedback(&self)

Source

pub fn pause_transform_feedback(&self)

Source

pub fn resume_transform_feedback(&self)

Source

pub fn delete_transform_feedback(&self, transform_feedback: TransformFeedback)

Source

pub fn create_vertex_array(&self) -> Option<VertexArray>

Source

pub fn bind_vertex_array(&self, vertex_array: Option<VertexArray>)

Source

pub fn delete_vertex_array(&self, vertex_array: VertexArray)

Source

pub fn clear_depth_f(&self, depth: f32)

Source§

impl Context

Source

pub fn tex_image_2d_with_image_bitmap( &self, target: u32, level: i32, internal_format: i32, format: u32, ty: u32, image_bitmap: &ImageBitmap, ) -> Result<(), JsValue>

Source

pub fn tex_image_2d_with_image_bitmap_and_width_and_height( &self, target: u32, level: i32, internal_format: i32, width: i32, height: i32, format: u32, ty: u32, image_bitmap: &ImageBitmap, ) -> Result<(), JsValue>

Source

pub fn tex_image_2d_with_html_canvas( &self, target: u32, level: i32, internal_format: i32, format: u32, ty: u32, canvas: &HtmlCanvasElement, ) -> Result<(), JsValue>

Source

pub fn tex_image_2d_with_html_canvas_and_width_and_height( &self, target: u32, level: i32, internal_format: i32, width: i32, height: i32, format: u32, ty: u32, canvas: &HtmlCanvasElement, ) -> Result<(), JsValue>

Source

pub fn tex_image_2d_with_html_image( &self, target: u32, level: i32, internal_format: i32, format: u32, ty: u32, image: &HtmlImageElement, ) -> Result<(), JsValue>

Source

pub fn tex_image_2d_with_html_image_and_width_and_height( &self, target: u32, level: i32, internal_format: i32, width: i32, height: i32, format: u32, ty: u32, image: &HtmlImageElement, ) -> Result<(), JsValue>

Source

pub fn tex_image_2d_with_html_video( &self, target: u32, level: i32, internal_format: i32, format: u32, ty: u32, video: &HtmlVideoElement, ) -> Result<(), JsValue>

Source

pub fn tex_image_2d_with_html_video_and_width_and_height( &self, target: u32, level: i32, internal_format: i32, width: i32, height: i32, format: u32, ty: u32, video: &HtmlVideoElement, ) -> Result<(), JsValue>

Source

pub fn tex_image_2d_with_image_data( &self, target: u32, level: i32, internal_format: i32, format: u32, ty: u32, image_data: &ImageData, ) -> Result<(), JsValue>

Source

pub fn tex_image_2d_with_image_data_and_width_and_height( &self, target: u32, level: i32, internal_format: i32, width: i32, height: i32, format: u32, ty: u32, image_data: &ImageData, ) -> Result<(), JsValue>

Source

pub fn tex_sub_image_2d_with_image_bitmap( &self, target: u32, level: i32, x_offset: i32, y_offset: i32, format: u32, ty: u32, image_bitmap: &ImageBitmap, ) -> Result<(), JsValue>

Source

pub fn tex_sub_image_2d_with_image_bitmap_and_width_and_height( &self, target: u32, level: i32, x_offset: i32, y_offset: i32, width: i32, height: i32, format: u32, ty: u32, image_bitmap: &ImageBitmap, ) -> Result<(), JsValue>

Source

pub fn tex_sub_image_2d_with_html_canvas( &self, target: u32, level: i32, x_offset: i32, y_offset: i32, format: u32, ty: u32, canvas: &HtmlCanvasElement, ) -> Result<(), JsValue>

Source

pub fn tex_sub_image_2d_with_html_canvas_and_width_and_height( &self, target: u32, level: i32, x_offset: i32, y_offset: i32, width: i32, height: i32, format: u32, ty: u32, canvas: &HtmlCanvasElement, ) -> Result<(), JsValue>

Source

pub fn tex_sub_image_2d_with_html_image( &self, target: u32, level: i32, x_offset: i32, y_offset: i32, format: u32, ty: u32, image: &HtmlImageElement, ) -> Result<(), JsValue>

Source

pub fn tex_sub_image_2d_with_html_image_and_width_and_height( &self, target: u32, level: i32, x_offset: i32, y_offset: i32, width: i32, height: i32, format: u32, ty: u32, image: &HtmlImageElement, ) -> Result<(), JsValue>

Source

pub fn tex_sub_image_2d_with_html_video( &self, target: u32, level: i32, x_offset: i32, y_offset: i32, format: u32, ty: u32, video: &HtmlVideoElement, ) -> Result<(), JsValue>

Source

pub fn tex_sub_image_2d_with_html_video_and_width_and_height( &self, target: u32, level: i32, x_offset: i32, y_offset: i32, width: i32, height: i32, format: u32, ty: u32, video: &HtmlVideoElement, ) -> Result<(), JsValue>

Source

pub fn tex_sub_image_2d_with_image_data( &self, target: u32, level: i32, x_offset: i32, y_offset: i32, format: u32, ty: u32, image_data: &ImageData, ) -> Result<(), JsValue>

Source

pub fn tex_sub_image_2d_with_image_data_and_width_and_height( &self, target: u32, level: i32, x_offset: i32, y_offset: i32, width: i32, height: i32, format: u32, ty: u32, image_data: &ImageData, ) -> Result<(), JsValue>

Trait Implementations§

Source§

impl Clone for Context

Source§

fn clone(&self) -> Context

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Context

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Context

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Context

Source§

fn eq(&self, other: &Context) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Context

Source§

impl Eq for Context

Source§

impl StructuralPartialEq for Context

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more