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
Implementations§
Source§impl WebGL2RenderingContext
impl WebGL2RenderingContext
Sourcepub fn create_buffer(&self) -> WebGLRSBuffer<'_>
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
impl WebGL2RenderingContext
Sourcepub fn create_framebuffer(&self) -> WebGLRSFramebuffer<'_>
pub fn create_framebuffer(&self) -> WebGLRSFramebuffer<'_>
Creates and initializes a new WebGLRSFramebuffer
object
Source§impl WebGL2RenderingContext
impl WebGL2RenderingContext
Sourcepub fn create_query(&self) -> WebGLRSQuery<'_>
pub fn create_query(&self) -> WebGLRSQuery<'_>
Creates and initializes a WebGLRSQuery
object, that provide ways to asynchronously query for information.
Sourcepub fn query(&self, target: QueryTarget) -> WebGLRSQuery<'_>
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
impl WebGL2RenderingContext
Sourcepub fn create_renderbuffer(&self) -> WebGLRSRenderbuffer<'_>
pub fn create_renderbuffer(&self) -> WebGLRSRenderbuffer<'_>
Creates and initializes WebGLRSRenderbuffer object.
Source§impl WebGL2RenderingContext
impl WebGL2RenderingContext
pub fn new(id: &str) -> WebGL2RenderingContext
Sourcepub fn buffer_size(&self, target: BufferKind) -> i32
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.
Sourcepub fn buffer_usage(&self, target: BufferKind) -> DataHint
pub fn buffer_usage(&self, target: BufferKind) -> DataHint
Returns the usage of the currently bound buffer
§Arguments
target
- specifying the target buffer object.
Sourcepub fn renderbuffer_internal_format(
&self,
target: RenderbufferKind,
) -> RenderbufferFormat
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.
Sourcepub fn renderbuffer_width(&self, target: RenderbufferKind) -> i32
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.
Sourcepub fn renderbuffer_height(&self, target: RenderbufferKind) -> i32
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.
Sourcepub fn renderbuffer_green_size(&self, target: RenderbufferKind) -> i32
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.
Sourcepub fn renderbuffer_blue_size(&self, target: RenderbufferKind) -> i32
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.
Sourcepub fn renderbuffer_red_size(&self, target: RenderbufferKind) -> i32
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.
Sourcepub fn renderbuffer_alpha_size(&self, target: RenderbufferKind) -> i32
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.
Sourcepub fn renderbuffer_depth_size(&self, target: RenderbufferKind) -> i32
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.
Sourcepub fn renderbuffer_stencil_size(&self, target: RenderbufferKind) -> i32
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.
Sourcepub fn renderbuffer_samples(&self, target: RenderbufferKind) -> i32
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.
Sourcepub fn texture_mag_filter(&self, target: TextureKind) -> TextureMagFilter
pub fn texture_mag_filter(&self, target: TextureKind) -> TextureMagFilter
Sourcepub fn texture_min_filter(&self, target: TextureKind) -> TextureMinFilter
pub fn texture_min_filter(&self, target: TextureKind) -> TextureMinFilter
Sourcepub fn texture_wrap_s(&self, target: TextureKind) -> TextureWrap
pub fn texture_wrap_s(&self, target: TextureKind) -> TextureWrap
Returns the wrapping function for texture coordinate s
§Arguments
target
- specifying the binding point (target).
Sourcepub fn texture_wrap_t(&self, target: TextureKind) -> TextureWrap
pub fn texture_wrap_t(&self, target: TextureKind) -> TextureWrap
Returns the wrapping function for texture coordinate t
§Arguments
target
- specifying the binding point (target).
Sourcepub fn texture_base_level(&self, target: TextureKind) -> i32
pub fn texture_base_level(&self, target: TextureKind) -> i32
Sourcepub fn texture_compare_func(&self, target: TextureKind) -> DepthTest
pub fn texture_compare_func(&self, target: TextureKind) -> DepthTest
Sourcepub fn texture_compare_mode(&self, target: TextureKind) -> CompareMode
pub fn texture_compare_mode(&self, target: TextureKind) -> CompareMode
Sourcepub fn texture_immutable_format(&self, target: TextureKind) -> bool
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).
Sourcepub fn texture_immutable_levels(&self, target: TextureKind) -> u32
pub fn texture_immutable_levels(&self, target: TextureKind) -> u32
Returns the immutable levels for a texture
§Arguments
target
- specifying the binding point (target).
Sourcepub fn texture_max_level(&self, target: TextureKind) -> i32
pub fn texture_max_level(&self, target: TextureKind) -> i32
Returns the maximum texture mipmap array level
§Arguments
target
- specifying the binding point (target).
Sourcepub fn texture_max_lod(&self, target: TextureKind) -> f32
pub fn texture_max_lod(&self, target: TextureKind) -> f32
Returns the texture maximum level-of-detail value
§Arguments
target
- specifying the binding point (target).
Sourcepub fn texture_min_lod(&self, target: TextureKind) -> f32
pub fn texture_min_lod(&self, target: TextureKind) -> f32
Returns the texture minimum level-of-detail value
§Arguments
target
- specifying the binding point (target).
Sourcepub fn texture_wrap_r(&self, target: TextureKind) -> TextureWrap
pub fn texture_wrap_r(&self, target: TextureKind) -> TextureWrap
Returns the wrapping function for texture coordinate r
§Arguments
target
- specifying the binding point (target).
Sourcepub fn buffer_data<B: Buffer>(
&self,
target: BufferKind,
src_data: &B,
usage: DataHint,
)
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 bufferusage
- specifying the usage pattern of the data store.
Sourcepub fn buffer_sub_data<B: Buffer>(
&self,
target: BufferKind,
offset: i64,
src_data: &B,
)
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
Sourcepub 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>
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.xhtmlpixel_type
- specifying the data type of the texel data.src_data
- pixel source for the texture
Sourcepub 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>
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.xhtmlpixel_type
- specifying the data type of the texel data.pixels
- pixel source for the texture
Sourcepub fn read_pixels<I: Image>(
&self,
x: u32,
y: u32,
width: u32,
height: u32,
format: PixelReadFormat,
pixel_type: PixelType,
pixels: &mut I,
) -> Result<(), JsValue>
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.
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
impl WebGL2RenderingContext
Sourcepub fn canvas(&self) -> HTMLCanvasElement
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
Source§impl WebGL2RenderingContext
impl WebGL2RenderingContext
Sourcepub fn drawing_buffer_width(&self) -> u32
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
impl WebGL2RenderingContext
Sourcepub fn drawing_buffer_height(&self) -> u32
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
impl WebGL2RenderingContext
Sourcepub fn is_context_lost(&self) -> bool
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
impl WebGL2RenderingContext
Sourcepub fn active_texture(&self, texture: TextureUnit)
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
impl WebGL2RenderingContext
Sourcepub fn blend_equation(&self, mode: BlendEquation)
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
impl WebGL2RenderingContext
Sourcepub fn blend_equation_separate(
&self,
mode_rgb: BlendEquation,
mode_alpha: BlendEquation,
)
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
impl WebGL2RenderingContext
Sourcepub fn blend_func(&self, sfactor: BlendMode, dfactor: BlendMode)
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
impl WebGL2RenderingContext
Sourcepub fn clear_color(&self, red: f32, green: f32, blue: f32, alpha: f32)
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
impl WebGL2RenderingContext
Sourcepub fn clear_depth(&self, depth: f32)
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
impl WebGL2RenderingContext
Sourcepub fn clear_stencil(&self, s: i32)
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
impl WebGL2RenderingContext
Sourcepub fn depth_func(&self, func: DepthTest)
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
impl WebGL2RenderingContext
Sourcepub fn depth_mask(&self, flag: bool)
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
impl WebGL2RenderingContext
Sourcepub fn depth_range(&self, z_near: f32, z_far: f32)
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
impl WebGL2RenderingContext
Sourcepub fn front_face(&self, mode: FrontFaceDirection)
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
impl WebGL2RenderingContext
Sourcepub fn hint(&self, target: HintTarget, mode: HintMode)
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
impl WebGL2RenderingContext
Sourcepub fn is_enabled(&self, cap: Flag)
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
impl WebGL2RenderingContext
Sourcepub fn line_width(&self, width: f32)
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
impl WebGL2RenderingContext
Sourcepub fn pixel_storei(&self, pname: PixelStorageMode, param: i32)
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
impl WebGL2RenderingContext
Sourcepub fn polygon_offset(&self, factor: f32, units: f32)
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
impl WebGL2RenderingContext
Sourcepub fn sample_coverage(&self, value: f32, invert: bool)
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
impl WebGL2RenderingContext
Sourcepub fn stencil_func(&self, func: StencilTest, reference: i32, mask: u32)
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
impl WebGL2RenderingContext
Sourcepub fn stencil_func_separate(
&self,
face: Culling,
func: StencilTest,
reference: i32,
mask: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn stencil_mask(&self, mask: u32)
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
impl WebGL2RenderingContext
Sourcepub fn stencil_mask_separate(&self, face: Culling, mask: u32)
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
impl WebGL2RenderingContext
Sourcepub fn stencil_op(
&self,
fail: StencilAction,
zfail: StencilAction,
zpass: StencilAction,
)
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
impl WebGL2RenderingContext
Sourcepub fn stencil_op_separate(
&self,
face: Culling,
fail: StencilAction,
zfail: StencilAction,
zpass: StencilAction,
)
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
impl WebGL2RenderingContext
Sourcepub fn check_framebuffer_status(&self, target: FramebufferKind) -> bool
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
impl WebGL2RenderingContext
Sourcepub fn renderbuffer_storage(
&self,
target: RenderbufferKind,
internalFormat: RenderbufferFormat,
width: u32,
height: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn copy_tex_image_2d(
&self,
target: TextureBindPoint,
level: u32,
internalformat: PixelCopyFormat,
x: i32,
y: i32,
width: u32,
height: u32,
border: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn copy_tex_sub_image_2d(
&self,
target: TextureBindPoint,
level: u32,
xoffset: i32,
yoffset: i32,
x: i32,
y: i32,
width: u32,
height: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn generate_mipmap(&self, target: TextureKind)
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
impl WebGL2RenderingContext
Sourcepub fn tex_parameter_f(
&self,
target: TextureKind,
pname: TextureParameter,
param: f32,
)
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
impl WebGL2RenderingContext
Sourcepub fn tex_parameter_i(
&self,
target: TextureKind,
pname: TextureParameter,
param: i32,
)
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
impl WebGL2RenderingContext
Sourcepub fn get_shader_precision_format(
&self,
shader_type: ShaderKind,
precision_type: ShaderPrecision,
) -> WebGLShaderPrecisionFormat
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
impl WebGL2RenderingContext
Sourcepub fn disable_vertex_attrib_array(&self, index: u32)
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
impl WebGL2RenderingContext
Sourcepub fn enable_vertex_attrib_array(&self, index: u32)
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
impl WebGL2RenderingContext
Sourcepub fn get_vertex_attrib_offset(&self, index: u32, pname: VertexAttrib) -> i64
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
impl WebGL2RenderingContext
Sourcepub fn vertex_attrib_1f(&self, index: u32, v0: f32)
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
impl WebGL2RenderingContext
Sourcepub fn vertex_attrib_pointer(
&self,
index: u32,
size: AttributeSize,
attribute_type: AttributeType,
normalized: bool,
stride: u8,
offset: i32,
)
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
impl WebGL2RenderingContext
Sourcepub fn draw_arrays(&self, mode: Primitives, first: u32, count: u32)
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
impl WebGL2RenderingContext
Sourcepub fn draw_elements(
&self,
mode: Primitives,
count: u32,
data_type: DataType,
offset: i64,
)
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
impl WebGL2RenderingContext
Sourcepub fn copy_buffer_sub_data(
&self,
readTarget: BufferKind,
writeTarget: BufferKind,
readOffset: i64,
writeOffset: i64,
size: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn blit_framebuffer(
&self,
srcX0: i32,
srcY0: i32,
srcX1: i32,
srcY1: i32,
dstX0: i32,
dstY0: i32,
dstX1: i32,
dstY1: i32,
mask: BufferBit,
filter: TextureMagFilter,
)
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
impl WebGL2RenderingContext
Sourcepub fn read_buffer(&self, src: ColorBuffer)
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
impl WebGL2RenderingContext
Sourcepub fn get_internal_format_parameter(
&self,
target: RenderbufferKind,
internal_format: RenderbufferFormat,
pname: InformationType,
) -> Vec<i32>
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
impl WebGL2RenderingContext
Sourcepub fn renderbuffer_storage_multisample(
&self,
target: RenderbufferKind,
samples: u32,
internal_format: RenderbufferFormat,
width: u32,
height: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn tex_storage_2d(
&self,
target: Texture2DKind,
levels: u32,
internal_format: RenderbufferFormat,
width: u32,
height: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn tex_storage_3d(
&self,
target: Texture3DKind,
levels: u32,
internalformat: RenderbufferFormat,
width: u32,
height: u32,
depth: u32,
)
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
impl WebGL2RenderingContext
Sourcepub 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,
)
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
impl WebGL2RenderingContext
Sourcepub 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,
)
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
impl WebGL2RenderingContext
Sourcepub 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,
)
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
impl WebGL2RenderingContext
Sourcepub fn vertex_attrib_i_4iv(&self, index: u32, value: Vec<i32>)
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
impl WebGL2RenderingContext
Sourcepub fn vertex_attrib_i_4uiv(&self, index: u32, value: Vec<u32>)
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
impl WebGL2RenderingContext
Sourcepub fn vertex_attrib_i_pointer(
&self,
index: u32,
size: AttributeSize,
data_type: AttributeType,
stride: u32,
offset: i64,
)
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
impl WebGL2RenderingContext
Sourcepub fn vertex_attrib_divisor(&self, index: u32, divisor: u32)
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
impl WebGL2RenderingContext
Sourcepub fn draw_arrays_instanced(
&self,
mode: Primitives,
first: i32,
count: u32,
instanceCount: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn draw_elements_instanced(
&self,
mode: Primitives,
count: u32,
data_type: AttributeType,
offset: i64,
instanceCount: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn draw_range_elements(
&self,
mode: Primitives,
start: u32,
end: u32,
count: u32,
data_type: AttributeType,
offset: i64,
)
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
impl WebGL2RenderingContext
Sourcepub fn clear_buffer_fv(
&self,
buffer: BufferBit,
drawbuffer: i32,
values: Vec<u8>,
srcOffset: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn begin_transform_feedback(&self, primitive_mode: TransformFeedbackMode)
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
impl WebGL2RenderingContext
Sourcepub fn end_transform_feedback(&self)
pub fn end_transform_feedback(&self)
The WebGL2RenderingContext.endTransformFeedback() method of the WebGL 2 API ends a transform feedback operation.
Source§impl WebGL2RenderingContext
impl WebGL2RenderingContext
Sourcepub fn pause_transform_feedback(&self)
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
impl WebGL2RenderingContext
Sourcepub fn resume_transform_feedback(&self)
pub fn resume_transform_feedback(&self)
The WebGL2RenderingContext.resumeTransformFeedback() method of the WebGL 2 API resumes a transform feedback operation.
Source§impl WebGL2RenderingContext
impl WebGL2RenderingContext
Sourcepub fn end_query(&self, target: QueryTarget)
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
impl WebGL2RenderingContext
Sourcepub fn create_sampler(&self) -> WebGLRSSampler<'_>
pub fn create_sampler(&self) -> WebGLRSSampler<'_>
Creates and initializes a WebGLRSSampler
object.
Source§impl WebGL2RenderingContext
WebGLRSProgram
impl WebGL2RenderingContext
WebGLRSProgram
Sourcepub fn create_program(&self) -> WebGLRSProgram<'_>
pub fn create_program(&self) -> WebGLRSProgram<'_>
Creates and initializes a WebGLRSProgram
Source§impl WebGL2RenderingContext
impl WebGL2RenderingContext
Sourcepub fn create_shader(&self, kind: ShaderKind) -> WebGLRSShader<'_>
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
impl WebGL2RenderingContext
Sourcepub fn fence_sync(&self, conditions: GPUState, flags: u32) -> WebGLRSSync<'_>
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
impl WebGL2RenderingContext
Sourcepub fn create_texture(&self) -> WebGLRSTexture<'_>
pub fn create_texture(&self) -> WebGLRSTexture<'_>
Creates and initializes a WebGLRSTexture
Source§impl WebGL2RenderingContext
impl WebGL2RenderingContext
Sourcepub fn create_transform_feedback(&self) -> WebGLRSTransformFeedback<'_>
pub fn create_transform_feedback(&self) -> WebGLRSTransformFeedback<'_>
Creates and initializes a WebGLRSTransformFeedback
object.
Source§impl WebGL2RenderingContext
impl WebGL2RenderingContext
Sourcepub fn uniform_1f(&self, location: &WebGLUniformLocation, v0: f32)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_2f(&self, location: &WebGLUniformLocation, v0: f32, v1: f32)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_3f(
&self,
location: &WebGLUniformLocation,
v0: f32,
v1: f32,
v2: f32,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_4f(
&self,
location: &WebGLUniformLocation,
v0: f32,
v1: f32,
v2: f32,
v3: f32,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_1i(&self, location: &WebGLUniformLocation, v0: i32)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_2i(&self, location: &WebGLUniformLocation, v0: i32, v1: i32)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_3i(
&self,
location: &WebGLUniformLocation,
v0: i32,
v1: i32,
v2: i32,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_4i(
&self,
location: &WebGLUniformLocation,
v0: i32,
v1: i32,
v2: i32,
v3: i32,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_1fv(&self, location: &WebGLUniformLocation, value: Vec<f32>)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_2fv(&self, location: &WebGLUniformLocation, value: Vec<f32>)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_3fv(&self, location: &WebGLUniformLocation, value: Vec<f32>)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_4fv(&self, location: &WebGLUniformLocation, value: Vec<f32>)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_1iv(&self, location: &WebGLUniformLocation, value: Vec<i32>)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_2iv(&self, location: &WebGLUniformLocation, value: Vec<i32>)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_3iv(&self, location: &WebGLUniformLocation, value: Vec<i32>)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_4iv(&self, location: &WebGLUniformLocation, value: Vec<i32>)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_matrix_2fv(
&self,
location: &WebGLUniformLocation,
transpose: bool,
value: Vec<f32>,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_matrix_3fv(
&self,
location: &WebGLUniformLocation,
transpose: bool,
value: Vec<f32>,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_matrix_4fv(
&self,
location: &WebGLUniformLocation,
transpose: bool,
value: Vec<f32>,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_1ui(&self, location: &WebGLUniformLocation, v0: u32)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_2ui(&self, location: &WebGLUniformLocation, v0: u32, v1: u32)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_3ui(
&self,
location: &WebGLUniformLocation,
v0: u32,
v1: u32,
v2: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_4ui(
&self,
location: &WebGLUniformLocation,
v0: u32,
v1: u32,
v2: u32,
v3: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_1uiv(&self, location: &WebGLUniformLocation, value: Vec<u32>)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_2uiv(&self, location: &WebGLUniformLocation, value: Vec<u32>)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_3uiv(&self, location: &WebGLUniformLocation, value: Vec<u32>)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_4uiv(&self, location: &WebGLUniformLocation, value: Vec<u32>)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_matrix_2x3fv(
&self,
location: &WebGLUniformLocation,
transpose: bool,
data: Vec<f32>,
srcOffset: u32,
srcLength: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_matrix_2x4fv(
&self,
location: &WebGLUniformLocation,
transpose: bool,
data: Vec<f32>,
srcOffset: u32,
srcLength: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_matrix_3x2fv(
&self,
location: &WebGLUniformLocation,
transpose: bool,
data: Vec<f32>,
srcOffset: u32,
srcLength: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_matrix_3x4fv(
&self,
location: &WebGLUniformLocation,
transpose: bool,
data: Vec<f32>,
srcOffset: u32,
srcLength: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_matrix_4x2fv(
&self,
location: &WebGLUniformLocation,
transpose: bool,
data: Vec<f32>,
srcOffset: u32,
srcLength: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn uniform_matrix_4x3fv(
&self,
location: &WebGLUniformLocation,
transpose: bool,
data: Vec<f32>,
srcOffset: u32,
srcLength: u32,
)
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
impl WebGL2RenderingContext
Sourcepub fn create_vertex_array(&self) -> WebGLRSVertexArrayObject<'_>
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>§
pub const NULL: JsValue
pub const UNDEFINED: JsValue
pub const TRUE: JsValue
pub const FALSE: JsValue
Sourcepub fn as_f64(&self) -> Option<f64>
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
.
Sourcepub fn as_string(&self) -> Option<String>
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.
Sourcepub fn as_bool(&self) -> Option<bool>
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
.
Sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
Tests whether this JS value is undefined
Sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Tests whether the type of this JS value is function
.
Sourcepub fn js_in(&self, obj: &JsValue) -> bool
pub fn js_in(&self, obj: &JsValue) -> bool
Applies the binary in
JS operator on the two JsValue
s.
Sourcepub fn loose_eq(&self, other: &JsValue) -> bool
pub fn loose_eq(&self, other: &JsValue) -> bool
Compare two JsValue
s for equality, using the ==
operator in JS.
Sourcepub fn unsigned_shr(&self, rhs: &JsValue) -> u32
pub fn unsigned_shr(&self, rhs: &JsValue) -> u32
Applies the binary >>>
JS operator on the two JsValue
s.
Sourcepub fn checked_div(&self, rhs: &JsValue) -> JsValue
pub fn checked_div(&self, rhs: &JsValue) -> JsValue
Applies the binary /
JS operator on two JsValue
s, catching and returning any RangeError
thrown.
Sourcepub fn pow(&self, rhs: &JsValue) -> JsValue
pub fn pow(&self, rhs: &JsValue) -> JsValue
Applies the binary **
JS operator on the two JsValue
s.
Sourcepub fn lt(&self, other: &JsValue) -> bool
pub fn lt(&self, other: &JsValue) -> bool
Applies the binary <
JS operator on the two JsValue
s.
Sourcepub fn le(&self, other: &JsValue) -> bool
pub fn le(&self, other: &JsValue) -> bool
Applies the binary <=
JS operator on the two JsValue
s.
Sourcepub fn ge(&self, other: &JsValue) -> bool
pub fn ge(&self, other: &JsValue) -> bool
Applies the binary >=
JS operator on the two JsValue
s.
Sourcepub fn gt(&self, other: &JsValue) -> bool
pub fn gt(&self, other: &JsValue) -> bool
Applies the binary >
JS operator on the two JsValue
s.
Sourcepub fn unchecked_into_f64(&self) -> f64
pub fn unchecked_into_f64(&self) -> f64
Applies the unary +
JS operator on a JsValue
. Can throw.
Trait Implementations§
Source§impl AsRef<JsValue> for WebGL2RenderingContext
impl AsRef<JsValue> for WebGL2RenderingContext
Source§impl AsRef<WebGL2RenderingContext> for WebGL2RenderingContext
impl AsRef<WebGL2RenderingContext> for WebGL2RenderingContext
Source§fn as_ref(&self) -> &WebGL2RenderingContext
fn as_ref(&self) -> &WebGL2RenderingContext
Source§impl Clone for WebGL2RenderingContext
impl Clone for WebGL2RenderingContext
Source§fn clone(&self) -> WebGL2RenderingContext
fn clone(&self) -> WebGL2RenderingContext
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Deref for WebGL2RenderingContext
impl Deref for WebGL2RenderingContext
Source§impl From<JsValue> for WebGL2RenderingContext
impl From<JsValue> for WebGL2RenderingContext
Source§fn from(obj: JsValue) -> WebGL2RenderingContext
fn from(obj: JsValue) -> WebGL2RenderingContext
Source§impl From<WebGL2RenderingContext> for JsValue
impl From<WebGL2RenderingContext> for JsValue
Source§fn from(obj: WebGL2RenderingContext) -> JsValue
fn from(obj: WebGL2RenderingContext) -> JsValue
Source§impl FromWasmAbi for WebGL2RenderingContext
impl FromWasmAbi for WebGL2RenderingContext
Source§impl<'a> IntoWasmAbi for &'a WebGL2RenderingContext
impl<'a> IntoWasmAbi for &'a WebGL2RenderingContext
Source§impl IntoWasmAbi for WebGL2RenderingContext
impl IntoWasmAbi for WebGL2RenderingContext
Source§impl JsCast for WebGL2RenderingContext
impl JsCast for WebGL2RenderingContext
Source§fn instanceof(val: &JsValue) -> bool
fn instanceof(val: &JsValue) -> bool
instanceof
check to see whether the JsValue
provided is an instance of this type. Read moreSource§fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js(val: JsValue) -> Self
Source§fn unchecked_from_js_ref(val: &JsValue) -> &Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self
Source§fn has_type<T>(&self) -> boolwhere
T: JsCast,
fn has_type<T>(&self) -> boolwhere
T: JsCast,
T
. Read moreSource§fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
T
. Read moreSource§fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
T
. Read moreSource§fn unchecked_into<T>(self) -> Twhere
T: JsCast,
fn unchecked_into<T>(self) -> Twhere
T: JsCast,
Source§fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
Source§impl LongRefFromWasmAbi for WebGL2RenderingContext
impl LongRefFromWasmAbi for WebGL2RenderingContext
Source§type Anchor = WebGL2RenderingContext
type Anchor = WebGL2RenderingContext
RefFromWasmAbi::Anchor
Source§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abi
Source§impl<'a> OptionIntoWasmAbi for &'a WebGL2RenderingContext
impl<'a> OptionIntoWasmAbi for &'a WebGL2RenderingContext
Source§impl RefFromWasmAbi for WebGL2RenderingContext
impl RefFromWasmAbi for WebGL2RenderingContext
Source§type Abi = <JsValue as RefFromWasmAbi>::Abi
type Abi = <JsValue as RefFromWasmAbi>::Abi
Self
are recovered from.Source§type Anchor = ManuallyDrop<WebGL2RenderingContext>
type Anchor = ManuallyDrop<WebGL2RenderingContext>
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.Auto Trait Implementations§
impl Freeze for WebGL2RenderingContext
impl RefUnwindSafe for WebGL2RenderingContext
impl !Send for WebGL2RenderingContext
impl !Sync for WebGL2RenderingContext
impl Unpin for WebGL2RenderingContext
impl UnwindSafe for WebGL2RenderingContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abi
Source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.