Struct WebGL2RenderingContext

Source
pub struct WebGL2RenderingContext { /* private fields */ }
Expand description

The WebGL2RenderingContext interface provides the OpenGL ES 3.0 rendering context for the drawing surface of an HTML element.

Implementations§

Source§

impl WebGL2RenderingContext

Source

pub fn create_buffer(&self) -> WebGLRSBuffer<'_>

Creates a new WebGLRSBuffer object which is used for storing data such as vertices or colors.

Source§

impl WebGL2RenderingContext

Source

pub fn create_framebuffer(&self) -> WebGLRSFramebuffer<'_>

Creates and initializes a new WebGLRSFramebuffer object

Source§

impl WebGL2RenderingContext

Source

pub fn create_query(&self) -> WebGLRSQuery<'_>

Creates and initializes a WebGLRSQuery object, that provide ways to asynchronously query for information.

Source

pub fn query(&self, target: QueryTarget) -> WebGLRSQuery<'_>

Returns the currently active WebGLQuery for the target, or null.

§Arguments
  • target - specifying the target of the query TODO nullable -> Option
Source§

impl WebGL2RenderingContext

Source

pub fn create_renderbuffer(&self) -> WebGLRSRenderbuffer<'_>

Creates and initializes WebGLRSRenderbuffer object.

Source§

impl WebGL2RenderingContext

Source

pub fn new(id: &str) -> WebGL2RenderingContext

Source

pub fn buffer_size(&self, target: BufferKind) -> i32

Returns the size of the currently bound buffer in bytes

§Arguments
  • target - specifying the target buffer object.
Source

pub fn buffer_usage(&self, target: BufferKind) -> DataHint

Returns the usage of the currently bound buffer

§Arguments
  • target - specifying the target buffer object.
Source

pub fn renderbuffer_internal_format( &self, target: RenderbufferKind, ) -> RenderbufferFormat

Returns the internal format of the currently bound renderbuffer

§Arguments
  • target - specifying the target renderbuffer object.
Source

pub fn renderbuffer_width(&self, target: RenderbufferKind) -> i32

Returns the width of the image of the currently bound renderbuffer.

§Arguments
  • target - specifying the target renderbuffer object.
Source

pub fn renderbuffer_height(&self, target: RenderbufferKind) -> i32

Returns the height of the image of the currently bound renderbuffer.

§Arguments
  • target - specifying the target renderbuffer object.
Source

pub fn renderbuffer_green_size(&self, target: RenderbufferKind) -> i32

Returns the resolution size (in bits) for the green color.

§Arguments
  • target - specifying the target renderbuffer object.
Source

pub fn renderbuffer_blue_size(&self, target: RenderbufferKind) -> i32

Returns the resolution size (in bits) for the blue color.

§Arguments
  • target - specifying the target renderbuffer object.
Source

pub fn renderbuffer_red_size(&self, target: RenderbufferKind) -> i32

Returns the resolution size (in bits) for the red color.

§Arguments
  • target - specifying the target renderbuffer object.
Source

pub fn renderbuffer_alpha_size(&self, target: RenderbufferKind) -> i32

Returns the resolution size (in bits) for the alpha component.

§Arguments
  • target - specifying the target renderbuffer object.
Source

pub fn renderbuffer_depth_size(&self, target: RenderbufferKind) -> i32

Returns the resolution size (in bits) for the depth component.

§Arguments
  • target - specifying the target renderbuffer object.
Source

pub fn renderbuffer_stencil_size(&self, target: RenderbufferKind) -> i32

Returns the resolution size (in bits) for the stencil component.

§Arguments
  • target - specifying the target renderbuffer object.
Source

pub fn renderbuffer_samples(&self, target: RenderbufferKind) -> i32

Returns the number of samples of the image of the currently bound renderbuffer.

§Arguments
  • target - specifying the target renderbuffer object.
Source

pub fn texture_mag_filter(&self, target: TextureKind) -> TextureMagFilter

Returns the texture magnification filter

§Arguments
  • target - specifying the binding point (target).
Source

pub fn texture_min_filter(&self, target: TextureKind) -> TextureMinFilter

Returns the texture minification filter

§Arguments
  • target - specifying the binding point (target).
Source

pub fn texture_wrap_s(&self, target: TextureKind) -> TextureWrap

Returns the wrapping function for texture coordinate s

§Arguments
  • target - specifying the binding point (target).
Source

pub fn texture_wrap_t(&self, target: TextureKind) -> TextureWrap

Returns the wrapping function for texture coordinate t

§Arguments
  • target - specifying the binding point (target).
Source

pub fn texture_base_level(&self, target: TextureKind) -> i32

Returns the texture mipmap level

§Arguments
  • target - specifying the binding point (target).
Source

pub fn texture_compare_func(&self, target: TextureKind) -> DepthTest

Returns the texture comparison function

§Arguments
  • target - specifying the binding point (target).
Source

pub fn texture_compare_mode(&self, target: TextureKind) -> CompareMode

Returns the texture comparison mode

§Arguments
  • target - specifying the binding point (target).
Source

pub fn texture_immutable_format(&self, target: TextureKind) -> bool

Returns whether the texture format and size is immutable

§Arguments
  • target - specifying the binding point (target).
Source

pub fn texture_immutable_levels(&self, target: TextureKind) -> u32

Returns the immutable levels for a texture

§Arguments
  • target - specifying the binding point (target).
Source

pub fn texture_max_level(&self, target: TextureKind) -> i32

Returns the maximum texture mipmap array level

§Arguments
  • target - specifying the binding point (target).
Source

pub fn texture_max_lod(&self, target: TextureKind) -> f32

Returns the texture maximum level-of-detail value

§Arguments
  • target - specifying the binding point (target).
Source

pub fn texture_min_lod(&self, target: TextureKind) -> f32

Returns the texture minimum level-of-detail value

§Arguments
  • target - specifying the binding point (target).
Source

pub fn texture_wrap_r(&self, target: TextureKind) -> TextureWrap

Returns the wrapping function for texture coordinate r

§Arguments
  • target - specifying the binding point (target).
Source

pub fn buffer_data<B: Buffer>( &self, target: BufferKind, src_data: &B, usage: DataHint, )

Initializes and creates the buffer object’s data store.

§Arguments
  • target - specifying the binding point (target)
  • src_data - the source data to be stored in the buffer
  • usage - specifying the usage pattern of the data store.
Source

pub fn buffer_sub_data<B: Buffer>( &self, target: BufferKind, offset: i64, src_data: &B, )

Updates a subset of a buffer object’s data store.

§Arguments
  • target - specifying the binding point (target)
  • offset - specifying an offset in bytes where the data replacement will start.
  • src_data - the source data to be stored in the buffer
Source

pub fn tex_image_2d<I: Image>( &self, target: TextureBindPoint, level: u32, internalformat: PixelCopyFormat, width: u32, height: u32, format: PixelCopyFormat, pixel_type: PixelType, src_data: &I, ) -> Result<(), JsValue>

Specifies and loads a two-dimensional texture image.

§Arguments
  • target - specifying the binding point (target) of the active texture.
  • level - specifying the level of detail. Level 0 is the base image level and level n is the nth mipmap reduction level.
  • internalformat - specifying the color components in the texture.
  • width - specifying the width of the texture.
  • height - specifying the height of the texture.
  • format - specifying the format of the texel data. To view the combinations possible see https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml
  • pixel_type - specifying the data type of the texel data.
  • src_data - pixel source for the texture
Source

pub fn tex_sub_image_2d<I: Image>( &self, target: TextureBindPoint, level: u32, xoffset: u32, yoffset: u32, width: u32, height: u32, format: PixelCopyFormat, pixel_type: PixelType, pixels: &I, ) -> Result<(), JsValue>

Specifies a sub-rectangle of the current texture.

§Arguments
  • target - specifying the binding point (target) of the active texture.
  • level - specifying the level of detail. Level 0 is the base image level and level n is the nth mipmap reduction level.
  • xoffset - specifying the lower left texel x coordinate of a width-wide by height-wide rectangular subregion of the texture array.
  • yoffset - specifying the lower left texel y coordinate of a width-wide by height-wide rectangular subregion of the texture array.
  • width - specifying the width of the texture.
  • height - specifying the height of the texture.
  • format - specifying the format of the texel data. To view the combinations possible see https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml
  • pixel_type - specifying the data type of the texel data.
  • pixels - pixel source for the texture
Source

pub fn read_pixels<I: Image>( &self, x: u32, y: u32, width: u32, height: u32, format: PixelReadFormat, pixel_type: PixelType, pixels: &mut I, ) -> Result<(), JsValue>

Reads a block of pixels from a specified rectangle of the current color framebuffer into an array object.

§Arguments
  • x - specifying the first horizontal pixel that is read from the lower left corner of a rectangular block of pixels.
  • y - specifying the first vertical pixel that is read from the lower left corner of a rectangular block of pixels.
  • width - specifying the width of the rectangle.
  • height - specifying the height of the rectangle.
  • format - specifying the format of the pixel data.
  • pixel_type - specifying the data type of the pixel data.
  • pixels - An array object to read data into. The array type must match the type of the type parameter.
Source

pub fn get_buffer_sub_data<B: Buffer>( &self, target: BufferKind, src_offset: i64, dst_data: &mut B, dst_offset: u32, length: u32, ) -> Result<(), JsValue>

Source§

impl WebGL2RenderingContext

Source

pub fn canvas(&self) -> HTMLCanvasElement

The WebGLRenderingContext.canvas property is a read-only reference to the HTMLCanvasElement or OffscreenCanvas object that is associated with the context. It might be null if it is not associated with a element or an OffscreenCanvas object.

Source§

impl WebGL2RenderingContext

Source

pub fn drawing_buffer_width(&self) -> u32

The read-only WebGLRenderingContext.drawingBufferWidth property represents the actual width of the current drawing buffer. It should match the width attribute of the <canvas> element associated with this context, but might differ if the implementation is not able to provide the requested width.

Source§

impl WebGL2RenderingContext

Source

pub fn drawing_buffer_height(&self) -> u32

The read-only WebGLRenderingContext.drawingBufferHeight property represents the actual height of the current drawing buffer. It should match the height attribute of the <canvas> element associated with this context, but might differ if the implementation is not able to provide the requested height.

Source§

impl WebGL2RenderingContext

Source

pub fn is_context_lost(&self) -> bool

The WebGLRenderingContext.getContextAttributes() method returns a WebGLContextAttributes object that contains the actual context parameters. Might return null, if the context is lost. The WebGLRenderingContext.isContextLost() method returns a Boolean indicating whether or not the WebGL context has been lost.

Source§

impl WebGL2RenderingContext

Source

pub fn scissor(&self, x: i32, y: i32, width: u32, height: u32)

The WebGLRenderingContext.scissor() method of the WebGL API sets a scissor box, which limits the drawing to a specified rectangle.

Source§

impl WebGL2RenderingContext

Source

pub fn viewport(&self, x: i32, y: i32, width: u32, height: u32)

The WebGLRenderingContext.viewport() method of the WebGL API sets the viewport, which specifies the affine transformation of x and y from normalized device coordinates to window coordinates.

Source§

impl WebGL2RenderingContext

Source

pub fn active_texture(&self, texture: TextureUnit)

The WebGLRenderingContext.activeTexture() method of the WebGL API specifies which texture unit to make active.

Source§

impl WebGL2RenderingContext

Source

pub fn blend_color(&self, red: f32, green: f32, blue: f32, alpha: f32)

The WebGLRenderingContext.blendColor() method of the WebGL API is used to set the source and destination blending factors.

Source§

impl WebGL2RenderingContext

Source

pub fn blend_equation(&self, mode: BlendEquation)

The WebGLRenderingContext.blendEquation() method of the WebGL API is used to set both the RGB blend equation and alpha blend equation to a single equation.

The blend equation determines how a new pixel is combined with a pixel already in the WebGLFramebuffer.

Source§

impl WebGL2RenderingContext

Source

pub fn blend_equation_separate( &self, mode_rgb: BlendEquation, mode_alpha: BlendEquation, )

The WebGLRenderingContext.blendEquationSeparate() method of the WebGL API is used to set the RGB blend equation and alpha blend equation separately.

The blend equation determines how a new pixel is combined with a pixel already in the WebGLFramebuffer.

Source§

impl WebGL2RenderingContext

Source

pub fn blend_func(&self, sfactor: BlendMode, dfactor: BlendMode)

The WebGLRenderingContext.blendFunc() method of the WebGL API defines which function is used for blending pixel arithmetic.

Source§

impl WebGL2RenderingContext

Source

pub fn blend_func_separate( &self, src_rgb: BlendMode, dst_rgb: BlendMode, src_alpha: BlendMode, dst_alpha: BlendMode, )

The WebGLRenderingContext.blendFuncSeparate() method of the WebGL API defines which function is used for blending pixel arithmetic for RGB and alpha components separately.

Source§

impl WebGL2RenderingContext

Source

pub fn clear_color(&self, red: f32, green: f32, blue: f32, alpha: f32)

The WebGLRenderingContext.clearColor() method of the WebGL API specifies the color values used when clearing color buffers.

This specifies what color values to use when calling the clear() method. The values are clamped between 0 and 1.

Source§

impl WebGL2RenderingContext

Source

pub fn clear_depth(&self, depth: f32)

The WebGLRenderingContext.clearDepth() method of the WebGL API specifies the clear value for the depth buffer.

This specifies what depth value to use when calling the clear() method. The value is clamped between 0 and 1.

Source§

impl WebGL2RenderingContext

Source

pub fn clear_stencil(&self, s: i32)

The WebGLRenderingContext.clearStencil() method of the WebGL API specifies the clear value for the stencil buffer.

This specifies what stencil value to use when calling the clear() method.

Source§

impl WebGL2RenderingContext

Source

pub fn color_mask(&self, red: bool, green: bool, blue: bool, alpha: bool)

The WebGLRenderingContext.colorMask() method of the WebGL API sets which color components to enable or to disable when drawing or rendering to a WebGLFramebuffer.

Source§

impl WebGL2RenderingContext

Source

pub fn cull_face(&self, mode: Culling)

The WebGLRenderingContext.cullFace() method of the WebGL API specifies whether or not front- and/or back-facing polygons can be culled.

Source§

impl WebGL2RenderingContext

Source

pub fn depth_func(&self, func: DepthTest)

The WebGLRenderingContext.depthFunc() method of the WebGL API specifies a function that compares incoming pixel depth to the current depth buffer value.

Source§

impl WebGL2RenderingContext

Source

pub fn depth_mask(&self, flag: bool)

The WebGLRenderingContext.depthMask() method of the WebGL API sets whether writing into the depth buffer is enabled or disabled.

Source§

impl WebGL2RenderingContext

Source

pub fn depth_range(&self, z_near: f32, z_far: f32)

The WebGLRenderingContext.depthRange() method of the WebGL API specifies the depth range mapping from normalized device coordinates to window or viewport coordinates.

Source§

impl WebGL2RenderingContext

Source

pub fn disable(&self, cap: Flag)

The WebGLRenderingContext.disable() method of the WebGL API disables specific WebGL capabilities for this context.

Source§

impl WebGL2RenderingContext

Source

pub fn enable(&self, cap: Flag)

The WebGLRenderingContext.enable() method of the WebGL API enables specific WebGL capabilities for this context.

Source§

impl WebGL2RenderingContext

Source

pub fn front_face(&self, mode: FrontFaceDirection)

The WebGLRenderingContext.frontFace() method of the WebGL API specifies whether polygons are front- or back-facing by setting a winding orientation.

Source§

impl WebGL2RenderingContext

Source

pub fn get_error(&self) -> Error

The WebGLRenderingContext.getParameter() method of the WebGL API returns a value for the passed parameter name. The WebGLRenderingContext.getError() method of the WebGL API returns error information.

Source§

impl WebGL2RenderingContext

Source

pub fn hint(&self, target: HintTarget, mode: HintMode)

The WebGLRenderingContext.hint() method of the WebGL API specifies hints for certain behaviors. The interpretation of these hints depend on the implementation.

Source§

impl WebGL2RenderingContext

Source

pub fn is_enabled(&self, cap: Flag)

The WebGLRenderingContext.isEnabled() method of the WebGL API tests whether a specific WebGL capability is enabled or not for this context.

By default, all capabilities except gl.DITHER are disabled.

Source§

impl WebGL2RenderingContext

Source

pub fn line_width(&self, width: f32)

The WebGLRenderingContext.lineWidth() method of the WebGL API sets the line width of rasterized lines.

Source§

impl WebGL2RenderingContext

Source

pub fn pixel_storei(&self, pname: PixelStorageMode, param: i32)

The WebGLRenderingContext.pixelStorei() method of the WebGL API specifies the pixel storage modes.

Source§

impl WebGL2RenderingContext

Source

pub fn polygon_offset(&self, factor: f32, units: f32)

The WebGLRenderingContext.polygonOffset() method of the WebGL API specifies the scale factors and units to calculate depth values.

The offset is added before the depth test is performed and before the value is written into the depth buffer.

Source§

impl WebGL2RenderingContext

Source

pub fn sample_coverage(&self, value: f32, invert: bool)

The WebGLRenderingContext.sampleCoverage() method of the WebGL API specifies multi-sample coverage parameters for anti-aliasing effects.

Source§

impl WebGL2RenderingContext

Source

pub fn stencil_func(&self, func: StencilTest, reference: i32, mask: u32)

The WebGLRenderingContext.stencilFunc() method of the WebGL API sets the front and back function and reference value for stencil testing.

Stencilling enables and disables drawing on a per-pixel basis. It is typically used in multipass rendering to achieve special effects.

Source§

impl WebGL2RenderingContext

Source

pub fn stencil_func_separate( &self, face: Culling, func: StencilTest, reference: i32, mask: u32, )

The WebGLRenderingContext.stencilFuncSeparate() method of the WebGL API sets the front and/or back function and reference value for stencil testing.

Stencilling enables and disables drawing on a per-pixel basis. It is typically used in multipass rendering to achieve special effects.

Source§

impl WebGL2RenderingContext

Source

pub fn stencil_mask(&self, mask: u32)

The WebGLRenderingContext.stencilMask() method of the WebGL API controls enabling and disabling of both the front and back writing of individual bits in the stencil planes.

The WebGLRenderingContext.stencilMaskSeparate() method can set front and back stencil writemasks to different values.

Source§

impl WebGL2RenderingContext

Source

pub fn stencil_mask_separate(&self, face: Culling, mask: u32)

The WebGLRenderingContext.stencilMaskSeparate() method of the WebGL API controls enabling and disabling of front and/or back writing of individual bits in the stencil planes.

The WebGLRenderingContext.stencilMask() method can set both, the front and back stencil writemasks to one value at the same time.

Source§

impl WebGL2RenderingContext

Source

pub fn stencil_op( &self, fail: StencilAction, zfail: StencilAction, zpass: StencilAction, )

The WebGLRenderingContext.stencilOp() method of the WebGL API sets both the front and back-facing stencil test actions.

Source§

impl WebGL2RenderingContext

Source

pub fn stencil_op_separate( &self, face: Culling, fail: StencilAction, zfail: StencilAction, zpass: StencilAction, )

The WebGLRenderingContext.stencilOpSeparate() method of the WebGL API sets the front and/or back-facing stencil test actions.

Source§

impl WebGL2RenderingContext

Source

pub fn check_framebuffer_status(&self, target: FramebufferKind) -> bool

The WebGLRenderingContext.checkFramebufferStatus() method of the WebGL API returns the completeness status of the WebGLFramebuffer object.

Source§

impl WebGL2RenderingContext

Source

pub fn renderbuffer_storage( &self, target: RenderbufferKind, internalFormat: RenderbufferFormat, width: u32, height: u32, )

The WebGLRenderingContext.renderbufferStorage() method of the WebGL API creates and initializes a renderbuffer object’s data store.

Source§

impl WebGL2RenderingContext

Source

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

The WebGLRenderingContext.copyTexImage2D() method of the WebGL API copies pixels from the current WebGLFramebuffer into a 2D texture image.

Source§

impl WebGL2RenderingContext

Source

pub fn copy_tex_sub_image_2d( &self, target: TextureBindPoint, level: u32, xoffset: i32, yoffset: i32, x: i32, y: i32, width: u32, height: u32, )

The WebGLRenderingContext.copyTexSubImage2D() method of the WebGL API copies pixels from the current WebGLFramebuffer into an existing 2D texture sub-image.

Source§

impl WebGL2RenderingContext

Source

pub fn generate_mipmap(&self, target: TextureKind)

The WebGLRenderingContext.generateMipmap() method of the WebGL API generates a set of mipmaps for a WebGLTexture object.

Mipmaps are used to create distance with objects. A higher-resolution mipmap is used for objects that are closer, and a lower-resolution mipmap is used for objects that are farther away. It starts with the resolution of the texture image and halves the resolution until a 1x1 dimension texture image is created.

Source§

impl WebGL2RenderingContext

Source

pub fn tex_parameter_f( &self, target: TextureKind, pname: TextureParameter, param: f32, )

The WebGLRenderingContext.texParameter[fi]() methods of the WebGL API set texture parameters.

Source§

impl WebGL2RenderingContext

Source

pub fn tex_parameter_i( &self, target: TextureKind, pname: TextureParameter, param: i32, )

The WebGLRenderingContext.texParameter[fi]() methods of the WebGL API set texture parameters.

Source§

impl WebGL2RenderingContext

Source

pub fn get_shader_precision_format( &self, shader_type: ShaderKind, precision_type: ShaderPrecision, ) -> WebGLShaderPrecisionFormat

The WebGLRenderingContext.getShaderPrecisionFormat() method of the WebGL API returns a new WebGLShaderPrecisionFormat object describing the range and precision for the specified shader numeric format.

Source§

impl WebGL2RenderingContext

Source

pub fn disable_vertex_attrib_array(&self, index: u32)

The WebGLRenderingContext.disableVertexAttribArray() method of the WebGL API turns the generic vertex attribute array off at a given index position.

Source§

impl WebGL2RenderingContext

Source

pub fn enable_vertex_attrib_array(&self, index: u32)

The WebGLRenderingContext method enableVertexAttribArray(), part of the WebGL API, turns on the generic vertex attribute array at the specified index into the list of attribute arrays.

Source§

impl WebGL2RenderingContext

Source

pub fn get_vertex_attrib_offset(&self, index: u32, pname: VertexAttrib) -> i64

The WebGLRenderingContext.getVertexAttrib() method of the WebGL API returns information about a vertex attribute at a given position. The WebGLRenderingContext.getVertexAttribOffset() method of the WebGL API returns the address of a specified vertex attribute.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_1f(&self, index: u32, v0: f32)

The WebGLRenderingContext.vertexAttrib[1234]fv methods of the WebGL API specify constant values for generic vertex attributes.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_2f(&self, index: u32, v0: f32, v1: f32)

The WebGLRenderingContext.vertexAttrib[1234]fv methods of the WebGL API specify constant values for generic vertex attributes.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_3f(&self, index: u32, v0: f32, v1: f32, v2: f32)

The WebGLRenderingContext.vertexAttrib[1234]fv methods of the WebGL API specify constant values for generic vertex attributes.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_4f(&self, index: u32, v0: f32, v1: f32, v2: f32, v3: f32)

The WebGLRenderingContext.vertexAttrib[1234]fv methods of the WebGL API specify constant values for generic vertex attributes.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_1fv(&self, index: u32, value: Vec<f32>)

The WebGLRenderingContext.vertexAttrib[1234]fv methods of the WebGL API specify constant values for generic vertex attributes.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_2fv(&self, index: u32, value: Vec<f32>)

The WebGLRenderingContext.vertexAttrib[1234]fv methods of the WebGL API specify constant values for generic vertex attributes.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_3fv(&self, index: u32, value: Vec<f32>)

The WebGLRenderingContext.vertexAttrib[1234]fv methods of the WebGL API specify constant values for generic vertex attributes.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_4fv(&self, index: u32, value: Vec<f32>)

The WebGLRenderingContext.vertexAttrib[1234]fv methods of the WebGL API specify constant values for generic vertex attributes.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_pointer( &self, index: u32, size: AttributeSize, attribute_type: AttributeType, normalized: bool, stride: u8, offset: i32, )

The WebGLRenderingContext.vertexAttribPointer() method of the WebGL API binds the buffer currently bound to gl.ARRAY_BUFFER to a generic vertex attribute of the current vertex buffer object and specifies its layout.

Source§

impl WebGL2RenderingContext

Source

pub fn clear(&self, mask: BufferBit)

The WebGLRenderingContext.clear() method of the WebGL API clears buffers to preset values.

The preset values can be set by clearColor(), clearDepth() or clearStencil().

The scissor box, dithering, and buffer writemasks can affect the clear() method.

Source§

impl WebGL2RenderingContext

Source

pub fn draw_arrays(&self, mode: Primitives, first: u32, count: u32)

The WebGLRenderingContext.drawArrays() method of the WebGL API renders primitives from array data.

Source§

impl WebGL2RenderingContext

Source

pub fn draw_elements( &self, mode: Primitives, count: u32, data_type: DataType, offset: i64, )

The WebGLRenderingContext.drawElements() method of the WebGL API renders primitives from array data.

Source§

impl WebGL2RenderingContext

Source

pub fn finish(&self)

The WebGLRenderingContext.finish() method of the WebGL API blocks execution until all previously called commands are finished.

Source§

impl WebGL2RenderingContext

Source

pub fn flush(&self)

The WebGLRenderingContext.flush() method of the WebGL API empties different buffer commands, causing all commands to be executed as quickly as possible.

Source§

impl WebGL2RenderingContext

Source

pub fn copy_buffer_sub_data( &self, readTarget: BufferKind, writeTarget: BufferKind, readOffset: i64, writeOffset: i64, size: u32, )

The WebGL2RenderingContext.copyBufferSubData() method of the WebGL 2 API copies part of the data of a buffer to another buffer.

Source§

impl WebGL2RenderingContext

Source

pub fn blit_framebuffer( &self, srcX0: i32, srcY0: i32, srcX1: i32, srcY1: i32, dstX0: i32, dstY0: i32, dstX1: i32, dstY1: i32, mask: BufferBit, filter: TextureMagFilter, )

The WebGL2RenderingContext.blitFramebuffer() method of the WebGL 2 API transfers a block of pixels from the read framebuffer to the draw framebuffer.

Source§

impl WebGL2RenderingContext

Source

pub fn read_buffer(&self, src: ColorBuffer)

The WebGL2RenderingContext.invalidateFramebuffer() method of the WebGL 2 API invalidates the contents of attachments in a framebuffer. The WebGL2RenderingContext.readBuffer() method of the WebGL 2 API selects a color buffer as the source for pixels for subsequent calls to copyTexImage2D, copyTexSubImage2D, copyTexSubImage3D or readPixels.

Source§

impl WebGL2RenderingContext

Source

pub fn get_internal_format_parameter( &self, target: RenderbufferKind, internal_format: RenderbufferFormat, pname: InformationType, ) -> Vec<i32>

The WebGL2RenderingContext.getInternalformatParameter() method of the WebGL 2 API returns information about implementation-dependent support for internal formats. FIXME: not sure about internal_format enum

Source§

impl WebGL2RenderingContext

Source

pub fn renderbuffer_storage_multisample( &self, target: RenderbufferKind, samples: u32, internal_format: RenderbufferFormat, width: u32, height: u32, )

The WebGL2RenderingContext.renderbufferStorageMultisample() method of the WebGL 2 API returns creates and initializes a renderbuffer object’s data store and allows specifying a number of samples to be used.

Source§

impl WebGL2RenderingContext

Source

pub fn tex_storage_2d( &self, target: Texture2DKind, levels: u32, internal_format: RenderbufferFormat, width: u32, height: u32, )

The WebGL2RenderingContext.texStorage2D() method of the WebGL API specifies all levels of two-dimensional texture storage. FIXME: revisit internal format

Source§

impl WebGL2RenderingContext

Source

pub fn tex_storage_3d( &self, target: Texture3DKind, levels: u32, internalformat: RenderbufferFormat, width: u32, height: u32, depth: u32, )

The WebGL2RenderingContext.texStorage3D() method of the WebGL API specifies all levels of a three-dimensional texture or two-dimensional array texture. FIXME: revisit internal format

Source§

impl WebGL2RenderingContext

Source

pub fn tex_image_3d( &self, target: Texture3DKind, level: u32, internalformat: RenderbufferFormat, width: u32, height: u32, depth: u32, border: u32, format: RenderbufferFormat, data_type: RenderbufferFormat, srcData: Vec<u8>, srcOffset: u32, )

The WebGLRenderingContext.texImage3D() method of the WebGL API specifies a three-dimensional texture image. FIXME: revisit internalformat, format, data_type FIXME: border is always 0 FIXME: different src types

Source§

impl WebGL2RenderingContext

Source

pub fn tex_sub_image_3d( &self, target: Texture3DKind, level: u32, xoffset: u32, yoffset: u32, zoffset: u32, width: u32, height: u32, depth: u32, format: RenderbufferFormat, data_type: RenderbufferFormat, srcData: Vec<u8>, srcOffset: u32, )

The WebGL2RenderingContext.texSubImage3D() method of the WebGL API specifies a sub-rectangle of the current texture. FIXME: revisit format, data_type FIXME: srcdata more types

Source§

impl WebGL2RenderingContext

Source

pub fn copy_tex_sub_image_3d( &self, target: Texture3DKind, level: u32, xoffset: u32, yoffset: u32, zoffset: u32, x: u32, y: u32, width: u32, height: u32, )

The WebGL2RenderingContext.copyTexSubImage3D() method of the WebGL API copies pixels from the current WebGLFramebuffer into an existing 3D texture sub-image.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_i_4i(&self, index: u32, v0: i32, v1: i32, v2: i32, v3: i32)

The WebGL2RenderingContext.vertexAttribI4[u]i[v]() methods of the WebGL 2 API specify integer values for generic vertex attributes.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_i_4ui( &self, index: u32, v0: u32, v1: u32, v2: u32, v3: u32, )

The WebGL2RenderingContext.vertexAttribI4[u]i[v]() methods of the WebGL 2 API specify integer values for generic vertex attributes.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_i_4iv(&self, index: u32, value: Vec<i32>)

The WebGL2RenderingContext.vertexAttribI4[u]i[v]() methods of the WebGL 2 API specify integer values for generic vertex attributes.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_i_4uiv(&self, index: u32, value: Vec<u32>)

The WebGL2RenderingContext.vertexAttribI4[u]i[v]() methods of the WebGL 2 API specify integer values for generic vertex attributes.

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_i_pointer( &self, index: u32, size: AttributeSize, data_type: AttributeType, stride: u32, offset: i64, )

The WebGL2RenderingContext.vertexAttribIPointer() method of the WebGL 2 API specifies integer data formats and locations of vertex attributes in a vertex attributes array. FIXME: revisit data_type

Source§

impl WebGL2RenderingContext

Source

pub fn vertex_attrib_divisor(&self, index: u32, divisor: u32)

The WebGL2RenderingContext.vertexAttribDivisor() method of the WebGL 2 API modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with gl.drawArraysInstanced() and gl.drawElementsInstanced().

Source§

impl WebGL2RenderingContext

Source

pub fn draw_arrays_instanced( &self, mode: Primitives, first: i32, count: u32, instanceCount: u32, )

The WebGL2RenderingContext.drawArraysInstanced() method of the WebGL 2 API renders primitives from array data like the gl.drawArrays() method. In addition, it can execute multiple instances of the range of elements.

Source§

impl WebGL2RenderingContext

Source

pub fn draw_elements_instanced( &self, mode: Primitives, count: u32, data_type: AttributeType, offset: i64, instanceCount: u32, )

The WebGL2RenderingContext.drawElementsInstanced() method of the WebGL 2 API renders primitives from array data like the gl.drawElements() method. In addition, it can execute multiple instances of a set of elements. FIXME: revisit data_type

Source§

impl WebGL2RenderingContext

Source

pub fn draw_range_elements( &self, mode: Primitives, start: u32, end: u32, count: u32, data_type: AttributeType, offset: i64, )

The WebGL2RenderingContext.drawRangeElements() method of the WebGL API renders primitives from array data in a given range. FIXME: revisit data_type

Source§

impl WebGL2RenderingContext

Source

pub fn clear_buffer_fv( &self, buffer: BufferBit, drawbuffer: i32, values: Vec<u8>, srcOffset: u32, )

The WebGL2RenderingContext.drawBuffers() method of the WebGL 2 API defines draw buffers to which fragment colors are written into. The draw buffer settings are part of the state of the currently bound framebuffer or the drawingbuffer if no framebuffer is bound. The WebGL2RenderingContext.clearBuffer[fiuv]() methods of the WebGL 2 API clear buffers from the currently bound framebuffer. FIXME values is array of rgba

Source§

impl WebGL2RenderingContext

Source

pub fn clear_buffer_iv( &self, buffer: BufferBit, drawbuffer: i32, values: Vec<u8>, srcOffset: u32, )

The WebGL2RenderingContext.clearBuffer[fiuv]() methods of the WebGL 2 API clear buffers from the currently bound framebuffer. FIXME values is array of rgba

Source§

impl WebGL2RenderingContext

Source

pub fn clear_buffer_uiv( &self, buffer: BufferBit, drawbuffer: i32, values: Vec<u8>, srcOffset: u32, )

The WebGL2RenderingContext.clearBuffer[fiuv]() methods of the WebGL 2 API clear buffers from the currently bound framebuffer. FIXME values is array of rgba

Source§

impl WebGL2RenderingContext

Source

pub fn clear_buffer_fi( &self, buffer: BufferBit, drawbuffer: i32, depth: f32, stencil: i32, )

The WebGL2RenderingContext.clearBuffer[fiuv]() methods of the WebGL 2 API clear buffers from the currently bound framebuffer. FIXME buffer can only be DEPTH_STENCIL

Source§

impl WebGL2RenderingContext

Source

pub fn begin_transform_feedback(&self, primitive_mode: TransformFeedbackMode)

The WebGL2RenderingContext.beginTransformFeedback() method of the WebGL 2 API starts a transform feedback operation.

Source§

impl WebGL2RenderingContext

Source

pub fn end_transform_feedback(&self)

The WebGL2RenderingContext.endTransformFeedback() method of the WebGL 2 API ends a transform feedback operation.

Source§

impl WebGL2RenderingContext

Source

pub fn pause_transform_feedback(&self)

The WebGL2RenderingContext.transformFeedbackVaryings() method of the WebGL 2 API specifies values to record in WebGLTransformFeedback buffers. The WebGL2RenderingContext.pauseTransformFeedback() method of the WebGL 2 API pauses a transform feedback operation.

Source§

impl WebGL2RenderingContext

Source

pub fn resume_transform_feedback(&self)

The WebGL2RenderingContext.resumeTransformFeedback() method of the WebGL 2 API resumes a transform feedback operation.

Source§

impl WebGL2RenderingContext

Source

pub fn end_query(&self, target: QueryTarget)

The WebGL2RenderingContext.endQuery() method of the WebGL 2 API marks the end of a given query target.

Source§

impl WebGL2RenderingContext

Source

pub fn create_sampler(&self) -> WebGLRSSampler<'_>

Creates and initializes a WebGLRSSampler object.

Source§

impl WebGL2RenderingContext

WebGLRSProgram

Source

pub fn create_program(&self) -> WebGLRSProgram<'_>

Creates and initializes a WebGLRSProgram

Source§

impl WebGL2RenderingContext

Source

pub fn create_shader(&self, kind: ShaderKind) -> WebGLRSShader<'_>

Creates a WebGLRSShader that can then be configured further using shader_source() and compile_shader().

§Arguments
  • kind - Kind of the shader (Vertex or Fragment)
Source§

impl WebGL2RenderingContext

Source

pub fn fence_sync(&self, conditions: GPUState, flags: u32) -> WebGLRSSync<'_>

Creates a new WebGLRSSync object and inserts it into the GL command stream.

§Arguments
  • conditions - specifying the condition that must be met to set the sync object’s state to.
  • flags - specifying a bitwise combination of flags controlling the behavior of the sync object. Must be 0 (exists for extensions only).
Source§

impl WebGL2RenderingContext

Source

pub fn create_texture(&self) -> WebGLRSTexture<'_>

Creates and initializes a WebGLRSTexture

Source§

impl WebGL2RenderingContext

Source

pub fn create_transform_feedback(&self) -> WebGLRSTransformFeedback<'_>

Creates and initializes a WebGLRSTransformFeedback object.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_1f(&self, location: &WebGLUniformLocation, v0: f32)

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_2f(&self, location: &WebGLUniformLocation, v0: f32, v1: f32)

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_3f( &self, location: &WebGLUniformLocation, v0: f32, v1: f32, v2: f32, )

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_4f( &self, location: &WebGLUniformLocation, v0: f32, v1: f32, v2: f32, v3: f32, )

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_1i(&self, location: &WebGLUniformLocation, v0: i32)

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_2i(&self, location: &WebGLUniformLocation, v0: i32, v1: i32)

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_3i( &self, location: &WebGLUniformLocation, v0: i32, v1: i32, v2: i32, )

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_4i( &self, location: &WebGLUniformLocation, v0: i32, v1: i32, v2: i32, v3: i32, )

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_1fv(&self, location: &WebGLUniformLocation, value: Vec<f32>)

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_2fv(&self, location: &WebGLUniformLocation, value: Vec<f32>)

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_3fv(&self, location: &WebGLUniformLocation, value: Vec<f32>)

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_4fv(&self, location: &WebGLUniformLocation, value: Vec<f32>)

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_1iv(&self, location: &WebGLUniformLocation, value: Vec<i32>)

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_2iv(&self, location: &WebGLUniformLocation, value: Vec<i32>)

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_3iv(&self, location: &WebGLUniformLocation, value: Vec<i32>)

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_4iv(&self, location: &WebGLUniformLocation, value: Vec<i32>)

The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_matrix_2fv( &self, location: &WebGLUniformLocation, transpose: bool, value: Vec<f32>, )

The WebGLRenderingContext.uniformMatrix[234]fv() methods of the WebGL API specify matrix values for uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_matrix_3fv( &self, location: &WebGLUniformLocation, transpose: bool, value: Vec<f32>, )

The WebGLRenderingContext.uniformMatrix[234]fv() methods of the WebGL API specify matrix values for uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_matrix_4fv( &self, location: &WebGLUniformLocation, transpose: bool, value: Vec<f32>, )

The WebGLRenderingContext.uniformMatrix[234]fv() methods of the WebGL API specify matrix values for uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_1ui(&self, location: &WebGLUniformLocation, v0: u32)

The WebGL2RenderingContext.uniform[1234][uif][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_2ui(&self, location: &WebGLUniformLocation, v0: u32, v1: u32)

The WebGL2RenderingContext.uniform[1234][uif][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_3ui( &self, location: &WebGLUniformLocation, v0: u32, v1: u32, v2: u32, )

The WebGL2RenderingContext.uniform[1234][uif][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_4ui( &self, location: &WebGLUniformLocation, v0: u32, v1: u32, v2: u32, v3: u32, )

The WebGL2RenderingContext.uniform[1234][uif][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_1uiv(&self, location: &WebGLUniformLocation, value: Vec<u32>)

The WebGL2RenderingContext.uniform[1234][uif][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_2uiv(&self, location: &WebGLUniformLocation, value: Vec<u32>)

The WebGL2RenderingContext.uniform[1234][uif][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_3uiv(&self, location: &WebGLUniformLocation, value: Vec<u32>)

The WebGL2RenderingContext.uniform[1234][uif][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_4uiv(&self, location: &WebGLUniformLocation, value: Vec<u32>)

The WebGL2RenderingContext.uniform[1234][uif][v]() methods of the WebGL API specify values of uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_matrix_2x3fv( &self, location: &WebGLUniformLocation, transpose: bool, data: Vec<f32>, srcOffset: u32, srcLength: u32, )

The WebGL2RenderingContext.uniformMatrix[234]x[234]fv() methods of the WebGL 2 API specify matrix values for uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_matrix_2x4fv( &self, location: &WebGLUniformLocation, transpose: bool, data: Vec<f32>, srcOffset: u32, srcLength: u32, )

The WebGL2RenderingContext.uniformMatrix[234]x[234]fv() methods of the WebGL 2 API specify matrix values for uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_matrix_3x2fv( &self, location: &WebGLUniformLocation, transpose: bool, data: Vec<f32>, srcOffset: u32, srcLength: u32, )

The WebGL2RenderingContext.uniformMatrix[234]x[234]fv() methods of the WebGL 2 API specify matrix values for uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_matrix_3x4fv( &self, location: &WebGLUniformLocation, transpose: bool, data: Vec<f32>, srcOffset: u32, srcLength: u32, )

The WebGL2RenderingContext.uniformMatrix[234]x[234]fv() methods of the WebGL 2 API specify matrix values for uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_matrix_4x2fv( &self, location: &WebGLUniformLocation, transpose: bool, data: Vec<f32>, srcOffset: u32, srcLength: u32, )

The WebGL2RenderingContext.uniformMatrix[234]x[234]fv() methods of the WebGL 2 API specify matrix values for uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn uniform_matrix_4x3fv( &self, location: &WebGLUniformLocation, transpose: bool, data: Vec<f32>, srcOffset: u32, srcLength: u32, )

The WebGL2RenderingContext.uniformMatrix[234]x[234]fv() methods of the WebGL 2 API specify matrix values for uniform variables.

Source§

impl WebGL2RenderingContext

Source

pub fn create_vertex_array(&self) -> WebGLRSVertexArrayObject<'_>

Creates and initializes a WebGLRSVertexArrayObject object that represents a vertex array object (VAO) pointing to vertex array data and which provides names for different sets of vertex data.

Methods from Deref<Target = JsValue>§

Source

pub const NULL: JsValue

Source

pub const UNDEFINED: JsValue

Source

pub const TRUE: JsValue

Source

pub const FALSE: JsValue

Source

pub fn as_f64(&self) -> Option<f64>

Returns the f64 value of this JS value if it’s an instance of a number.

If this JS value is not an instance of a number then this returns None.

Source

pub fn is_string(&self) -> bool

Tests whether this JS value is a JS string.

Source

pub fn as_string(&self) -> Option<String>

If this JS value is a string value, this function copies the JS string value into Wasm linear memory, encoded as UTF-8, and returns it as a Rust String.

To avoid the copying and re-encoding, consider the JsString::try_from() function from js-sys instead.

If this JS value is not an instance of a string or if it’s not valid utf-8 then this returns None.

§UTF-16 vs UTF-8

JavaScript strings in general are encoded as UTF-16, but Rust strings are encoded as UTF-8. This can cause the Rust string to look a bit different than the JS string sometimes. For more details see the documentation about the str type which contains a few caveats about the encodings.

Source

pub fn as_bool(&self) -> Option<bool>

Returns the bool value of this JS value if it’s an instance of a boolean.

If this JS value is not an instance of a boolean then this returns None.

Source

pub fn is_null(&self) -> bool

Tests whether this JS value is null

Source

pub fn is_undefined(&self) -> bool

Tests whether this JS value is undefined

Source

pub fn is_symbol(&self) -> bool

Tests whether the type of this JS value is symbol

Source

pub fn is_object(&self) -> bool

Tests whether typeof self == "object" && self !== null.

Source

pub fn is_array(&self) -> bool

Tests whether this JS value is an instance of Array.

Source

pub fn is_function(&self) -> bool

Tests whether the type of this JS value is function.

Source

pub fn is_bigint(&self) -> bool

Tests whether the type of this JS value is bigint.

Source

pub fn js_typeof(&self) -> JsValue

Applies the unary typeof JS operator on a JsValue.

MDN documentation

Source

pub fn js_in(&self, obj: &JsValue) -> bool

Applies the binary in JS operator on the two JsValues.

MDN documentation

Source

pub fn is_truthy(&self) -> bool

Tests whether the value is “truthy”.

Source

pub fn is_falsy(&self) -> bool

Tests whether the value is “falsy”.

Source

pub fn loose_eq(&self, other: &JsValue) -> bool

Compare two JsValues for equality, using the == operator in JS.

MDN documentation

Source

pub fn bit_not(&self) -> JsValue

Applies the unary ~ JS operator on a JsValue.

MDN documentation

Source

pub fn unsigned_shr(&self, rhs: &JsValue) -> u32

Applies the binary >>> JS operator on the two JsValues.

MDN documentation

Source

pub fn checked_div(&self, rhs: &JsValue) -> JsValue

Applies the binary / JS operator on two JsValues, catching and returning any RangeError thrown.

MDN documentation

Source

pub fn pow(&self, rhs: &JsValue) -> JsValue

Applies the binary ** JS operator on the two JsValues.

MDN documentation

Source

pub fn lt(&self, other: &JsValue) -> bool

Applies the binary < JS operator on the two JsValues.

MDN documentation

Source

pub fn le(&self, other: &JsValue) -> bool

Applies the binary <= JS operator on the two JsValues.

MDN documentation

Source

pub fn ge(&self, other: &JsValue) -> bool

Applies the binary >= JS operator on the two JsValues.

MDN documentation

Source

pub fn gt(&self, other: &JsValue) -> bool

Applies the binary > JS operator on the two JsValues.

MDN documentation

Source

pub fn unchecked_into_f64(&self) -> f64

Applies the unary + JS operator on a JsValue. Can throw.

MDN documentation

Trait Implementations§

Source§

impl AsRef<JsValue> for WebGL2RenderingContext

Source§

fn as_ref(&self) -> &JsValue

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<WebGL2RenderingContext> for WebGL2RenderingContext

Source§

fn as_ref(&self) -> &WebGL2RenderingContext

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for WebGL2RenderingContext

Source§

fn clone(&self) -> WebGL2RenderingContext

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

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

Performs copy-assignment from source. Read more
Source§

impl Deref for WebGL2RenderingContext

Source§

type Target = JsValue

The resulting type after dereferencing.
Source§

fn deref(&self) -> &JsValue

Dereferences the value.
Source§

impl From<JsValue> for WebGL2RenderingContext

Source§

fn from(obj: JsValue) -> WebGL2RenderingContext

Converts to this type from the input type.
Source§

impl From<WebGL2RenderingContext> for JsValue

Source§

fn from(obj: WebGL2RenderingContext) -> JsValue

Converts to this type from the input type.
Source§

impl FromWasmAbi for WebGL2RenderingContext

Source§

type Abi = <JsValue as FromWasmAbi>::Abi

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Recover a Self from Self::Abi. Read more
Source§

impl<'a> IntoWasmAbi for &'a WebGL2RenderingContext

Source§

type Abi = <&'a JsValue as IntoWasmAbi>::Abi

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> Self::Abi

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl IntoWasmAbi for WebGL2RenderingContext

Source§

type Abi = <JsValue as IntoWasmAbi>::Abi

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> Self::Abi

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl JsCast for WebGL2RenderingContext

Source§

fn instanceof(val: &JsValue) -> bool

Performs a dynamic instanceof check to see whether the JsValue provided is an instance of this type. Read more
Source§

fn unchecked_from_js(val: JsValue) -> Self

Performs a zero-cost unchecked conversion from a JsValue into an instance of Self Read more
Source§

fn unchecked_from_js_ref(val: &JsValue) -> &Self

Performs a zero-cost unchecked conversion from a &JsValue into an instance of &Self. Read more
Source§

fn has_type<T>(&self) -> bool
where T: JsCast,

Test whether this JS value has a type T. Read more
Source§

fn dyn_into<T>(self) -> Result<T, Self>
where T: JsCast,

Performs a dynamic cast (checked at runtime) of this value into the target type T. Read more
Source§

fn dyn_ref<T>(&self) -> Option<&T>
where T: JsCast,

Performs a dynamic cast (checked at runtime) of this value into the target type T. Read more
Source§

fn unchecked_into<T>(self) -> T
where T: JsCast,

Performs a zero-cost unchecked cast into the specified type. Read more
Source§

fn unchecked_ref<T>(&self) -> &T
where T: JsCast,

Performs a zero-cost unchecked cast into a reference to the specified type. Read more
Source§

fn is_instance_of<T>(&self) -> bool
where T: JsCast,

Test whether this JS value is an instance of the type T. Read more
Source§

fn is_type_of(val: &JsValue) -> bool

Performs a dynamic check to see whether the JsValue provided is a value of this type. Read more
Source§

impl LongRefFromWasmAbi for WebGL2RenderingContext

Source§

type Abi = <JsValue as LongRefFromWasmAbi>::Abi

Same as RefFromWasmAbi::Abi
Source§

type Anchor = WebGL2RenderingContext

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl OptionFromWasmAbi for WebGL2RenderingContext

Source§

fn is_none(abi: &Self::Abi) -> bool

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
Source§

impl<'a> OptionIntoWasmAbi for &'a WebGL2RenderingContext

Source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl OptionIntoWasmAbi for WebGL2RenderingContext

Source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl RefFromWasmAbi for WebGL2RenderingContext

Source§

type Abi = <JsValue as RefFromWasmAbi>::Abi

The Wasm ABI type references to Self are recovered from.
Source§

type Anchor = ManuallyDrop<WebGL2RenderingContext>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous.
Source§

unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

Recover a Self::Anchor from Self::Abi. Read more
Source§

impl WasmDescribe for WebGL2RenderingContext

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ReturnWasmAbi for T
where T: IntoWasmAbi,

Source§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
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<T> VectorFromWasmAbi for T
where T: JsObject,

Source§

impl<T> VectorIntoWasmAbi for T
where T: JsObject,