Skip to main content

WebSysWebGL2Surface

Struct WebSysWebGL2Surface 

Source
pub struct WebSysWebGL2Surface {
    pub window: Window,
    pub document: Document,
    pub canvas: HtmlCanvasElement,
    /* private fields */
}
Expand description

web-sys surface for WebGL2.

Fields§

§window: Window§document: Document§canvas: HtmlCanvasElement

Implementations§

Source§

impl WebSysWebGL2Surface

Source

pub fn new( canvas_name: impl AsRef<str>, ) -> Result<Self, WebSysWebGL2SurfaceError>

Create a new WebSysWebGL2Surface based on the name of the DOM canvas element named by canvas_name.

Source

pub fn new_with_params( canvas_name: impl AsRef<str>, params: impl AsRef<JsValue>, ) -> Result<Self, WebSysWebGL2SurfaceError>

Create a new WebSysWebGL2Surface based on the name of the DOM canvas element named by canvas_name and pass along a list of parameters when creating the WebGL context.

Source

pub fn from_canvas( window: Window, document: Document, canvas: HtmlCanvasElement, ) -> Result<Self, WebSysWebGL2SurfaceError>

Create a new WebSysWebGL2Surface based on a given HtmlCanvasElement.

Source

pub fn from_canvas_with_params( window: Window, document: Document, canvas: HtmlCanvasElement, params: impl AsRef<JsValue>, ) -> Result<Self, WebSysWebGL2SurfaceError>

Create a new WebSysWebGL2Surface based on a given HtmlCanvasElement and pass along a list of parameters when creating the WebGL context.

Source

pub fn back_buffer( &mut self, ) -> Result<Framebuffer<WebGL2, Dim2, (), ()>, FramebufferError>

Get the back buffer.

Trait Implementations§

Source§

impl GraphicsContext for WebSysWebGL2Surface

Source§

type Backend = WebGL2

Internal type used by the backend to cache, optimize and store data. This roughly represents the GPU data / context a backend implementation needs to work correctly.
Source§

fn backend(&mut self) -> &mut Self::Backend

Access the underlying backend.
Source§

fn query(&mut self) -> Query<'_, Self::Backend>
where Self::Backend: Query,

Access the query API.
Source§

fn new_pipeline_gate(&mut self) -> PipelineGate<'_, Self::Backend>

Create a new pipeline gate
Source§

fn new_framebuffer<D, CS, DS>( &mut self, size: <D as Dimensionable>::Size, mipmaps: usize, sampler: Sampler, ) -> Result<Framebuffer<Self::Backend, D, CS, DS>, FramebufferError>
where Self::Backend: Framebuffer<D>, D: Dimensionable, CS: ColorSlot<Self::Backend, D>, DS: DepthStencilSlot<Self::Backend, D>,

Create a new framebuffer. Read more
Source§

fn new_shader_stage<R>( &mut self, ty: StageType, src: R, ) -> Result<Stage<Self::Backend>, StageError>
where Self::Backend: Shader, R: AsRef<str>,

Create a new shader stage. Read more
Source§

fn new_shader_program<Sem, Out, Uni>( &mut self, ) -> ProgramBuilder<'_, Self, Sem, Out, Uni>
where Self::Backend: Shader, Sem: Semantics,

Create a new shader program. Read more
Source§

fn new_shader_data<T>( &mut self, values: impl IntoIterator<Item = T>, ) -> Result<ShaderData<Self::Backend, T>, ShaderDataError>
where Self::Backend: ShaderData<T>,

Create a new shader data. Read more
Source§

fn new_tess(&mut self) -> TessBuilder<'_, Self::Backend, ()>
where Self::Backend: Tess<(), (), (), Interleaved>,

Source§

fn new_deinterleaved_tess<V, W>( &mut self, ) -> TessBuilder<'_, Self::Backend, V, (), W, Deinterleaved>

Create a TessBuilder with deinterleaved memory. Read more
Source§

fn new_texture<D, P>( &mut self, size: <D as Dimensionable>::Size, sampler: Sampler, texels: TexelUpload<'_, [<P as Pixel>::Encoding]>, ) -> Result<Texture<Self::Backend, D, P>, TextureError>
where Self::Backend: Texture<D, P>, D: Dimensionable, P: Pixel,

Create a new texture from texels. Read more
Source§

fn new_texture_raw<D, P>( &mut self, size: <D as Dimensionable>::Size, sampler: Sampler, texels: TexelUpload<'_, [<P as Pixel>::RawEncoding]>, ) -> Result<Texture<Self::Backend, D, P>, TextureError>
where Self::Backend: Texture<D, P>, D: Dimensionable, P: Pixel,

Create a new texture from raw texels. Read more

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> 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.
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