[−][src]Struct uni_gl::GLContext
uni-gl internal OpenGL context.
You shouldn't use this struct directly. Instead, call the methods on WebGLRenderingContext
as it automatically dereferences into a GLContext
.
This doc is not intended to cover all OpenGL API in depth. Check https://www.khronos.org/opengl/ for more information.
Fields
reference: u32
openGL internal reference
is_webgl2: bool
whether this context is a WebGL 2.0 context
Methods
impl GLContext
[src]
pub fn new() -> GLContext
[src]
pub fn print<T: Into<String>>(msg: T)
[src]
pub fn create_buffer(&self) -> WebGLBuffer
[src]
create a new OpenGL buffer
pub fn delete_buffer(&self, buffer: &WebGLBuffer)
[src]
delete an existing buffer
pub fn bind_buffer(&self, kind: BufferKind, buffer: &WebGLBuffer)
[src]
bind a buffer to current state.
pub fn buffer_data(&self, kind: BufferKind, data: &[u8], draw: DrawMode)
[src]
fills a buffer with data.
kind : see GLContext::bind_buffer
.
pub fn buffer_sub_data(&self, kind: BufferKind, offset: u32, data: &[u8])
[src]
update a subset of a buffer
kind : see GLContext::bind_buffer
.
offset : offset in the buffer where data replacement will begin
pub fn unbind_buffer(&self, kind: BufferKind)
[src]
this buffer is not bound to the current state anymore.
pub fn create_shader(&self, kind: ShaderKind) -> WebGLShader
[src]
create a new shader.
pub fn shader_source(&self, shader: &WebGLShader, source: &str)
[src]
set or replace the source code in a shader
pub fn compile_shader(&self, shader: &WebGLShader)
[src]
compile a shader
pub fn create_program(&self) -> WebGLProgram
[src]
create a program
pub fn link_program(&self, program: &WebGLProgram)
[src]
link a program
pub fn use_program(&self, program: &WebGLProgram)
[src]
bind a program to the current state.
pub fn attach_shader(&self, program: &WebGLProgram, shader: &WebGLShader)
[src]
attach a shader to a program. A program must have two shaders : vertex and fragment shader.
pub fn bind_attrib_location(&self, program: &WebGLProgram, name: &str, loc: u32)
[src]
associate a generic vertex attribute index with a named attribute
pub fn get_attrib_location(
&self,
program: &WebGLProgram,
name: &str
) -> Option<u32>
[src]
&self,
program: &WebGLProgram,
name: &str
) -> Option<u32>
return the location of an attribute variable
pub fn get_uniform_location(
&self,
program: &WebGLProgram,
name: &str
) -> Option<WebGLUniformLocation>
[src]
&self,
program: &WebGLProgram,
name: &str
) -> Option<WebGLUniformLocation>
return the location of a uniform variable
pub fn vertex_attrib_pointer(
&self,
location: u32,
size: AttributeSize,
kind: DataType,
normalized: bool,
stride: u32,
offset: u32
)
[src]
&self,
location: u32,
size: AttributeSize,
kind: DataType,
normalized: bool,
stride: u32,
offset: u32
)
define an array of generic vertex attribute data
pub fn enable_vertex_attrib_array(&self, location: u32)
[src]
enable a generic vertex attribute array
pub fn clear_color(&self, r: f32, g: f32, b: f32, a: f32)
[src]
specify clear values for the color buffers
pub fn enable(&self, flag: i32)
[src]
enable GL capabilities.
flag should be one of Flag
pub fn disable(&self, flag: i32)
[src]
disable GL capabilities.
flag should be one of Flag
pub fn cull_face(&self, flag: Culling)
[src]
specify whether front- or back-facing polygons can be culled
pub fn depth_mask(&self, b: bool)
[src]
enable or disable writing into the depth buffer
pub fn depth_func(&self, d: DepthTest)
[src]
specify the value used for depth buffer comparisons
pub fn clear_depth(&self, value: f32)
[src]
specify the clear value for the depth buffer
pub fn clear(&self, bit: BufferBit)
[src]
clear buffers to preset values
pub fn viewport(&self, x: i32, y: i32, width: u32, height: u32)
[src]
set the viewport
pub fn draw_elements(
&self,
mode: Primitives,
count: usize,
kind: DataType,
offset: u32
)
[src]
&self,
mode: Primitives,
count: usize,
kind: DataType,
offset: u32
)
render primitives from indexed array data
pub fn draw_arrays(&self, mode: Primitives, count: usize)
[src]
render primitives from array data
pub fn read_pixels(
&self,
x: u32,
y: u32,
width: u32,
height: u32,
format: PixelFormat,
kind: PixelType,
data: &mut [u8]
)
[src]
&self,
x: u32,
y: u32,
width: u32,
height: u32,
format: PixelFormat,
kind: PixelType,
data: &mut [u8]
)
read a block of pixels from the frame buffer
pub fn pixel_storei(&self, storage: PixelStorageMode, value: i32)
[src]
set pixel storage modes
pub fn tex_image2d(
&self,
target: TextureBindPoint,
level: u8,
width: u16,
height: u16,
format: PixelFormat,
kind: PixelType,
pixels: &[u8]
)
[src]
&self,
target: TextureBindPoint,
level: u8,
width: u16,
height: u16,
format: PixelFormat,
kind: PixelType,
pixels: &[u8]
)
specify a two-dimensional texture image
pub fn tex_sub_image2d(
&self,
target: TextureBindPoint,
level: u8,
xoffset: u16,
yoffset: u16,
width: u16,
height: u16,
format: PixelFormat,
kind: PixelType,
pixels: &[u8]
)
[src]
&self,
target: TextureBindPoint,
level: u8,
xoffset: u16,
yoffset: u16,
width: u16,
height: u16,
format: PixelFormat,
kind: PixelType,
pixels: &[u8]
)
update a part of a two-dimensional texture subimage
pub fn compressed_tex_image2d(
&self,
target: TextureBindPoint,
level: u8,
compression: TextureCompression,
width: u16,
height: u16,
data: &[u8]
)
[src]
&self,
target: TextureBindPoint,
level: u8,
compression: TextureCompression,
width: u16,
height: u16,
data: &[u8]
)
specify a two-dimensional texture image in a compressed format
pub fn get_program_parameter(
&self,
program: &WebGLProgram,
pname: ShaderParameter
) -> i32
[src]
&self,
program: &WebGLProgram,
pname: ShaderParameter
) -> i32
return informations about current program
pub fn create_texture(&self) -> WebGLTexture
[src]
create a new texture object
pub fn delete_texture(&self, texture: &WebGLTexture)
[src]
destroy a texture object
pub fn generate_mipmap(&self)
[src]
generate mipmaps for current 2D texture
pub fn generate_mipmap_cube(&self)
[src]
generate mipmaps for current cube map texture
pub fn active_texture(&self, active: u32)
[src]
select active texture unit
pub fn bind_texture(&self, texture: &WebGLTexture)
[src]
bind a named 2D texture to a texturing target
pub fn unbind_texture(&self)
[src]
current 2D texture is not bound to current state anymore
pub fn bind_texture_cube(&self, texture: &WebGLTexture)
[src]
bind a named cube map texture to a texturing target
pub fn unbind_texture_cube(&self)
[src]
current cube map texture is not bound to current state anymore
pub fn blend_equation(&self, eq: BlendEquation)
[src]
set the RGB alpha blend equation
pub fn blend_func(&self, b1: BlendMode, b2: BlendMode)
[src]
specify pixel arithmetic for RGB and alpha components separately
pub fn blend_color(&self, r: f32, g: f32, b: f32, a: f32)
[src]
set the blend color
pub fn uniform_matrix_4fv(
&self,
location: &WebGLUniformLocation,
value: &[[f32; 4]; 4]
)
[src]
&self,
location: &WebGLUniformLocation,
value: &[[f32; 4]; 4]
)
specify the value of a mat4 uniform variable for the current program object
pub fn uniform_matrix_3fv(
&self,
location: &WebGLUniformLocation,
value: &[[f32; 3]; 3]
)
[src]
&self,
location: &WebGLUniformLocation,
value: &[[f32; 3]; 3]
)
specify the value of a mat3 uniform variable for the current program object
pub fn uniform_matrix_2fv(
&self,
location: &WebGLUniformLocation,
value: &[[f32; 2]; 2]
)
[src]
&self,
location: &WebGLUniformLocation,
value: &[[f32; 2]; 2]
)
specify the value of a mat2 uniform variable for the current program object
pub fn uniform_1i(&self, location: &WebGLUniformLocation, value: i32)
[src]
specify the value of an int uniform variable for the current program object
pub fn uniform_1f(&self, location: &WebGLUniformLocation, value: f32)
[src]
specify the value of a float uniform variable for the current program object
pub fn uniform_2f(&self, location: &WebGLUniformLocation, value: (f32, f32))
[src]
specify the value of a vec2 uniform variable for the current program object
pub fn uniform_3f(
&self,
location: &WebGLUniformLocation,
value: (f32, f32, f32)
)
[src]
&self,
location: &WebGLUniformLocation,
value: (f32, f32, f32)
)
specify the value of a vec3 uniform variable for the current program object
pub fn uniform_4f(
&self,
location: &WebGLUniformLocation,
value: (f32, f32, f32, f32)
)
[src]
&self,
location: &WebGLUniformLocation,
value: (f32, f32, f32, f32)
)
specify the value of a vec4 uniform variable for the current program object
pub fn tex_parameteri(
&self,
kind: TextureKind,
pname: TextureParameter,
param: i32
)
[src]
&self,
kind: TextureKind,
pname: TextureParameter,
param: i32
)
set texture integer parameters
pub fn tex_parameterfv(
&self,
kind: TextureKind,
pname: TextureParameter,
param: f32
)
[src]
&self,
kind: TextureKind,
pname: TextureParameter,
param: f32
)
set texture float parameters
pub fn create_vertex_array(&self) -> WebGLVertexArray
[src]
create a vertex array object
pub fn delete_vertex_array(&self, vao: &WebGLVertexArray)
[src]
destroy a vertex array object
pub fn bind_vertex_array(&self, vao: &WebGLVertexArray)
[src]
bind a vertex array object to current state
pub fn unbind_vertex_array(&self, _vao: &WebGLVertexArray)
[src]
current vertex array object is not bound to the current state anymore
pub fn draw_buffer(&self, buffers: &[ColorBuffer])
[src]
specify which color buffers are to be drawn into
pub fn create_framebuffer(&self) -> WebGLFrameBuffer
[src]
create a new framebuffer
pub fn delete_framebuffer(&self, fb: &WebGLFrameBuffer)
[src]
destroy a framebuffer
pub fn bind_framebuffer(&self, buffer: Buffers, fb: &WebGLFrameBuffer)
[src]
bind a framebuffer to the current state
pub fn framebuffer_texture2d(
&self,
target: Buffers,
attachment: Buffers,
textarget: TextureBindPoint,
texture: &WebGLTexture,
level: i32
)
[src]
&self,
target: Buffers,
attachment: Buffers,
textarget: TextureBindPoint,
texture: &WebGLTexture,
level: i32
)
attach a texture to a framebuffer
pub fn unbind_framebuffer(&self, buffer: Buffers)
[src]
unbind a framebuffer
Trait Implementations
impl Clone for GLContext
[src]
fn clone(&self) -> GLContext
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<GLContext> for GLContext
[src]
impl From<GLContext> for u32
[src]
impl Debug for GLContext
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,