sokol/gl
sokol_gl
Types
8Allocator
Allocator :: struct {
alloc_fn: proc(a0: c.size_t, a1: rawptr) -> (rawptr),
a0: c.size_t,
size_t: rawptr,
a1: rawptr,
free_fn: proc(a0: rawptr, a1: rawptr),
a0: rawptr,
a1: rawptr,
user_data: rawptr,
}Sourcesgl_allocator_t
Used in sgl_desc_t to provide custom memory-alloc and -free functions to sokol_gl.h. If memory management should be overridden, both the alloc and free function must be provided (e.g. it's not valid to override one function but not the other).
Context
Context :: struct {
id: u32,
}Sourcea context handle (created with sgl_make_context())
Context_Desc
Context_Desc :: struct {
max_vertices: c.int,
max_commands: c.int,
color_format: sg.Pixel_Format,
depth_format: sg.Pixel_Format,
sample_count: c.int,
}Sourcesgl_context_desc_t
Describes the initialization parameters of a rendering context. Creating additional contexts is useful if you want to render in separate sokol-gfx passes.
Desc
Desc :: struct {
max_vertices: c.int,
max_commands: c.int,
context_pool_size: c.int,
pipeline_pool_size: c.int,
color_format: sg.Pixel_Format,
depth_format: sg.Pixel_Format,
sample_count: c.int,
face_winding: sg.Face_Winding,
allocator: Allocator,
logger: Logger,
}SourceError
Error :: struct {
any: bool,
vertices_full: bool,
uniforms_full: bool,
commands_full: bool,
stack_overflow: bool,
stack_underflow: bool,
no_context: bool,
}Sourcesgl_error_t
Errors are reset each frame after calling sgl_draw(), get the last error code with sgl_error()
Log_Item
Log_Item :: enum i32 {
OK = 0,
MALLOC_FAILED = 1,
MAKE_PIPELINE_FAILED = 2,
PIPELINE_POOL_EXHAUSTED = 3,
ADD_COMMIT_LISTENER_FAILED = 4,
CONTEXT_POOL_EXHAUSTED = 5,
CANNOT_DESTROY_DEFAULT_CONTEXT = 6,
}SourceLogger
Logger :: struct {
func: proc(
a0: cstring,
a1: u32,
a2: u32,
a3: cstring,
a4: u32,
a5: cstring,
a6: rawptr,
),
a0: cstring,
a1: u32,
a2: u32,
a3: cstring,
a4: u32,
a5: cstring,
a6: rawptr,
user_data: rawptr,
}Sourcesgl_logger_t
Used in sgl_desc_t to provide a custom logging and error reporting callback to sokol-gl.
Pipeline
Pipeline :: struct {
id: u32,
}Sourcesokol_gl pipeline handle (created with sgl_make_pipeline())
Constants
4DEBUG
DEBUG :: _ = #config(SOKOL_GL_DEBUG, SOKOL_DEBUG)SourceSOKOL_DEBUG
SOKOL_DEBUG :: _ = #config(SOKOL_DEBUG, ODIN_DEBUG)SourceUSE_DLL
USE_DLL :: _ = #config(SOKOL_DLL, false)SourceUSE_GL
USE_GL :: _ = #config(SOKOL_USE_GL, false)Source