GlInterface
struct · ferroui-opengl · v0.5.0
struct GlInterface
GlInterface only includes essential members and members necessary for the framework itself. It is not a general-purpose interface for OpenGL API.
Use GlInterface::get_proc_address to get GL procedures you need, or
integrate it with third-party GL wrappers.
The members of GlBasicInfoInterface are available on the interface
too.
Members
clear_stencilclear_colordepth_funcdepth_maskclearviewportflushfinishfence_syncis_fence_sync_availableclient_wait_syncis_client_wait_sync_availabledelete_syncis_delete_sync_availableread_pixelsgen_framebuffersdelete_framebuffersbind_framebuffercheck_framebuffer_statusblit_framebufferis_blit_framebuffer_availablegen_renderbuffersdelete_renderbuffersbind_renderbufferrenderbuffer_storageframebuffer_renderbuffergen_texturesbind_textureactive_texturedelete_texturestex_image_2dcopy_tex_sub_image_2dtex_parameteritex_sub_image_2dis_tex_sub_image_2d_availablepixel_storeiis_pixel_storei_availableframebuffer_texture_2dcreate_shadershader_sourcecompile_shaderget_shaderivget_shader_info_logcreate_programattach_shaderlink_programget_programivget_program_info_logbind_attrib_locationgen_buffersbind_bufferbuffer_dataget_attrib_locationvertex_attrib_pointerenable_vertex_attrib_arrayuse_programdraw_arraysdraw_elementsget_uniform_locationuniform1funiform1iuniform_matrix4fvenabledisabledelete_buffersdelete_programdelete_shaderget_renderbuffer_parameteriv_nativedelete_vertex_arraysis_delete_vertex_arrays_availablebind_vertex_arrayis_bind_vertex_array_availablegen_vertex_arraysis_gen_vertex_arrays_availableread_bufferis_read_buffer_availabledraw_bufferis_draw_buffer_availablewrite_bufferis_write_buffer_availableegl_image_target_texture_2d_oesis_egl_image_target_texture_2d_oes_availablenewversionvendorrenderercontext_infoget_proc_addressclear_depthgen_framebufferdelete_framebuffergen_renderbufferdelete_renderbuffergen_texturedelete_textureshader_source_stringcompile_shader_and_get_errorlink_program_and_get_errorbind_attrib_location_stringgen_bufferget_attrib_location_stringget_uniform_location_stringdelete_bufferget_renderbuffer_parameterivdelete_vertex_arraygen_vertex_arrayfrom_native_utf8_get_proc_address
clear_stencil
fn clear_stencil(self: &Self, s: i32)
clear_color
fn clear_color(self: &Self, r: f32, g: f32, b: f32, a: f32)
depth_func
fn depth_func(self: &Self, value: i32)
depth_mask
fn depth_mask(self: &Self, value: i32)
clear
fn clear(self: &Self, bits: i32)
viewport
fn viewport(self: &Self, x: i32, y: i32, width: i32, height: i32)
flush
fn flush(self: &Self)
finish
fn finish(self: &Self)
fence_sync
fn fence_sync(self: &Self, condition: u32, flags: u32) -> isize
is_fence_sync_available
fn is_fence_sync_available(self: &Self) -> bool
Whether the context has the entry point behind fence_sync.
client_wait_sync
fn client_wait_sync(self: &Self, sync: isize, flags: u32, timeout: u64) -> u32
is_client_wait_sync_available
fn is_client_wait_sync_available(self: &Self) -> bool
Whether the context has the entry point behind client_wait_sync.
delete_sync
fn delete_sync(self: &Self, sync: isize)
is_delete_sync_available
fn is_delete_sync_available(self: &Self) -> bool
Whether the context has the entry point behind delete_sync.
read_pixels
unsafe fn read_pixels(self: &Self, x: i32, y: i32, width: i32, height: i32, format: i32, type_: i32, data: *mut c_void)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
gen_framebuffers
unsafe fn gen_framebuffers(self: &Self, count: i32, res: *mut i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
delete_framebuffers
unsafe fn delete_framebuffers(self: &Self, count: i32, framebuffers: *const i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
bind_framebuffer
fn bind_framebuffer(self: &Self, target: i32, fb: i32)
check_framebuffer_status
fn check_framebuffer_status(self: &Self, target: i32) -> i32
blit_framebuffer
fn blit_framebuffer(self: &Self, src_x0: i32, src_y0: i32, src_x1: i32, src_y1: i32, dst_x0: i32, dst_y0: i32, dst_x1: i32, dst_y1: i32, mask: i32, filter: i32)
is_blit_framebuffer_available
fn is_blit_framebuffer_available(self: &Self) -> bool
Whether the context has the entry point behind blit_framebuffer.
gen_renderbuffers
unsafe fn gen_renderbuffers(self: &Self, count: i32, res: *mut i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
delete_renderbuffers
unsafe fn delete_renderbuffers(self: &Self, count: i32, renderbuffers: *const i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
bind_renderbuffer
fn bind_renderbuffer(self: &Self, target: i32, fb: i32)
renderbuffer_storage
fn renderbuffer_storage(self: &Self, target: i32, internal_format: i32, width: i32, height: i32)
framebuffer_renderbuffer
fn framebuffer_renderbuffer(self: &Self, target: i32, attachment: i32, renderbuffer_target: i32, renderbuffer: i32)
gen_textures
unsafe fn gen_textures(self: &Self, count: i32, res: *mut i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
bind_texture
fn bind_texture(self: &Self, target: i32, fb: i32)
active_texture
fn active_texture(self: &Self, texture: i32)
delete_textures
unsafe fn delete_textures(self: &Self, count: i32, textures: *const i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
tex_image_2d
unsafe fn tex_image_2d(self: &Self, target: i32, level: i32, internal_format: i32, width: i32, height: i32, border: i32, format: i32, type_: i32, data: *const c_void)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
copy_tex_sub_image_2d
fn copy_tex_sub_image_2d(self: &Self, target: i32, level: i32, xoffset: i32, yoffset: i32, x: i32, y: i32, width: i32, height: i32)
tex_parameteri
fn tex_parameteri(self: &Self, target: i32, name: i32, value: i32)
tex_sub_image_2d
unsafe fn tex_sub_image_2d(self: &Self, target: i32, level: i32, xoffset: i32, yoffset: i32, width: i32, height: i32, format: i32, type_: i32, data: *const c_void)
Not from the reference: the upload of a part of a texture, for a render backend that presents frames it draws in memory through the context (the Vello backend, docs/porting/vello-backend.md, section 14).
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
is_tex_sub_image_2d_available
fn is_tex_sub_image_2d_available(self: &Self) -> bool
Whether the context has the entry point behind tex_sub_image_2d.
pixel_storei
fn pixel_storei(self: &Self, name: i32, value: i32)
Not from the reference, with tex_sub_image_2d.
is_pixel_storei_available
fn is_pixel_storei_available(self: &Self) -> bool
Whether the context has the entry point behind pixel_storei.
framebuffer_texture_2d
fn framebuffer_texture_2d(self: &Self, target: i32, attachment: i32, tex_target: i32, texture: i32, level: i32)
create_shader
fn create_shader(self: &Self, shader_type: i32) -> i32
shader_source
unsafe fn shader_source(self: &Self, shader: i32, count: i32, strings: *const *const c_char, lengths: *const i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
compile_shader
fn compile_shader(self: &Self, shader: i32)
get_shaderiv
unsafe fn get_shaderiv(self: &Self, shader: i32, name: i32, parameters: *mut i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
get_shader_info_log
unsafe fn get_shader_info_log(self: &Self, shader: i32, max_length: i32, length: *mut i32, info_log: *mut c_void)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
create_program
fn create_program(self: &Self) -> i32
attach_shader
fn attach_shader(self: &Self, program: i32, shader: i32)
link_program
fn link_program(self: &Self, program: i32)
get_programiv
unsafe fn get_programiv(self: &Self, program: i32, name: i32, parameters: *mut i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
get_program_info_log
unsafe fn get_program_info_log(self: &Self, program: i32, max_length: i32, len: *mut i32, info_log: *mut c_void)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
bind_attrib_location
unsafe fn bind_attrib_location(self: &Self, program: i32, index: i32, name: *const c_char)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
gen_buffers
unsafe fn gen_buffers(self: &Self, len: i32, rv: *mut i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
bind_buffer
fn bind_buffer(self: &Self, target: i32, buffer: i32)
buffer_data
unsafe fn buffer_data(self: &Self, target: i32, size: isize, data: *const c_void, usage: i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
get_attrib_location
unsafe fn get_attrib_location(self: &Self, program: i32, name: *const c_char) -> i32
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
vertex_attrib_pointer
unsafe fn vertex_attrib_pointer(self: &Self, index: i32, size: i32, type_: i32, normalized: i32, stride: i32, pointer: *const c_void)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
enable_vertex_attrib_array
fn enable_vertex_attrib_array(self: &Self, index: i32)
use_program
fn use_program(self: &Self, program: i32)
draw_arrays
unsafe fn draw_arrays(self: &Self, mode: i32, first: i32, count: i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
draw_elements
unsafe fn draw_elements(self: &Self, mode: i32, count: i32, type_: i32, indices: *const c_void)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
get_uniform_location
unsafe fn get_uniform_location(self: &Self, program: i32, name: *const c_char) -> i32
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
uniform1f
fn uniform1f(self: &Self, location: i32, falue: f32)
uniform1i
fn uniform1i(self: &Self, location: i32, value: i32)
uniform_matrix4fv
unsafe fn uniform_matrix4fv(self: &Self, location: i32, count: i32, transpose: u8, value: *const c_void)
transpose is a GLboolean: 0 or 1.
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
enable
fn enable(self: &Self, what: i32)
disable
fn disable(self: &Self, what: i32)
delete_buffers
unsafe fn delete_buffers(self: &Self, count: i32, buffers: *const i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
delete_program
fn delete_program(self: &Self, program: i32)
delete_shader
fn delete_shader(self: &Self, shader: i32)
get_renderbuffer_parameteriv_native
unsafe fn get_renderbuffer_parameteriv_native(self: &Self, target: i32, name: i32, value: *mut i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
delete_vertex_arrays
unsafe fn delete_vertex_arrays(self: &Self, count: i32, arrays: *const i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
is_delete_vertex_arrays_available
fn is_delete_vertex_arrays_available(self: &Self) -> bool
Whether the context has the entry point behind delete_vertex_arrays.
bind_vertex_array
fn bind_vertex_array(self: &Self, array: i32)
is_bind_vertex_array_available
fn is_bind_vertex_array_available(self: &Self) -> bool
Whether the context has the entry point behind bind_vertex_array.
gen_vertex_arrays
unsafe fn gen_vertex_arrays(self: &Self, n: i32, rv: *mut i32)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
is_gen_vertex_arrays_available
fn is_gen_vertex_arrays_available(self: &Self) -> bool
Whether the context has the entry point behind gen_vertex_arrays.
read_buffer
fn read_buffer(self: &Self, buffer: i32)
is_read_buffer_available
fn is_read_buffer_available(self: &Self) -> bool
Whether the context has the entry point behind read_buffer.
draw_buffer
fn draw_buffer(self: &Self, buffer: i32)
is_draw_buffer_available
fn is_draw_buffer_available(self: &Self) -> bool
Whether the context has the entry point behind draw_buffer.
write_buffer
fn write_buffer(self: &Self, buffer: i32)
is_write_buffer_available
fn is_write_buffer_available(self: &Self) -> bool
Whether the context has the entry point behind write_buffer.
egl_image_target_texture_2d_oes
unsafe fn egl_image_target_texture_2d_oes(self: &Self, target: i32, image: *mut c_void)
Safety
The pointers passed, and the memory OpenGL reads or writes because of this call, must satisfy what the OpenGL specification requires for the entry point.
is_egl_image_target_texture_2d_oes_available
fn is_egl_image_target_texture_2d_oes_available(self: &Self) -> bool
Whether the context has the entry point behind egl_image_target_texture_2d_oes.
new
unsafe fn new(version: GlVersion, get_proc_address: GetProcAddress) -> Self
Resolves the entry points of the current context, which implements
version of the API.
Safety
get_proc_address must return, for the name of an OpenGL entry point,
either null or the address of that entry point in an OpenGL
implementation whose calling convention is the platform's default
one. The interface must only be used on a thread on which a context
of that implementation is current.
Panics
Panics when a required entry point cannot be resolved; see
GlInterface::try_new.
version
fn version(self: &Self) -> Option<&str>
The GL_VERSION string of the context.
vendor
fn vendor(self: &Self) -> Option<&str>
The GL_VENDOR string of the context.
renderer
fn renderer(self: &Self) -> Option<&str>
The GL_RENDERER string of the context.
context_info
fn context_info(self: &Self) -> &GlContextInfo
The version and the extensions of the context.
get_proc_address
fn get_proc_address(self: &Self, proc: &str) -> *const c_void
Returns an OpenGL function by name.
The result is the address of the function, which can be cast to a function pointer of its signature; null when the context does not have the function.
clear_depth
fn clear_depth(self: &Self, value: f32)
glClearDepth or, where only that exists, glClearDepthf.
gen_framebuffer
fn gen_framebuffer(self: &Self) -> i32
Creates one framebuffer object.
delete_framebuffer
fn delete_framebuffer(self: &Self, fb: i32)
Deletes one framebuffer object.
gen_renderbuffer
fn gen_renderbuffer(self: &Self) -> i32
Creates one renderbuffer object.
delete_renderbuffer
fn delete_renderbuffer(self: &Self, renderbuffer: i32)
Deletes one renderbuffer object.
gen_texture
fn gen_texture(self: &Self) -> i32
Creates one texture object.
delete_texture
fn delete_texture(self: &Self, texture: i32)
Deletes one texture object.
shader_source_string
fn shader_source_string(self: &Self, shader: i32, source: &str)
Replaces the source of a shader.
compile_shader_and_get_error
fn compile_shader_and_get_error(self: &Self, shader: i32, source: &str) -> Option<String>
Compiles source as the shader. Returns the compiler's log when the
compilation fails and None when it succeeds.
link_program_and_get_error
fn link_program_and_get_error(self: &Self, program: i32) -> Option<String>
Links the program. Returns the linker's log when linking fails and
None when it succeeds.
bind_attrib_location_string
fn bind_attrib_location_string(self: &Self, program: i32, index: i32, name: &str)
Binds a vertex attribute of the program to a location.
gen_buffer
fn gen_buffer(self: &Self) -> i32
Creates one buffer object.
get_attrib_location_string
fn get_attrib_location_string(self: &Self, program: i32, name: &str) -> i32
The location of a vertex attribute of the program.
get_uniform_location_string
fn get_uniform_location_string(self: &Self, program: i32, name: &str) -> i32
The location of a uniform of the program.
delete_buffer
fn delete_buffer(self: &Self, buffer: i32)
Deletes one buffer object.
get_renderbuffer_parameteriv
fn get_renderbuffer_parameteriv(self: &Self, target: i32, name: i32) -> i32
glGetRenderbufferParameteriv for a parameter with one value.
delete_vertex_array
fn delete_vertex_array(self: &Self, array: i32)
Deletes one vertex array object.
gen_vertex_array
fn gen_vertex_array(self: &Self) -> i32
Creates one vertex array object.
from_native_utf8_get_proc_address
unsafe fn from_native_utf8_get_proc_address(version: GlVersion, get_proc_address: impl Fn(*const c_char) -> *const c_void + 'static) -> GlInterface
Creates the interface from a loader that takes a NUL-terminated name.
Safety
See GlInterface::new; get_proc_address must in addition accept a
pointer to a NUL-terminated name that is only valid during the call.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyClassDefaultsErasedDestructorIntoEitherDeref
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.