sokol.sgl #
Constants #
const version = gfx.version + 1
const context = Context{0x00010001} // C.SGL_DEFAULT_CONTEXT = { 0x00010001 }
fn begin_line_strip #
fn begin_line_strip()
fn begin_lines #
fn begin_lines()
fn begin_points #
fn begin_points()
define primitives, each begin/end is one draw command
fn begin_quads #
fn begin_quads()
fn begin_triangle_strip #
fn begin_triangle_strip()
fn begin_triangles #
fn begin_triangles()
fn c1i #
fn c1i(rgba u32)
fn c3b #
fn c3b(r u8, g u8, b u8)
fn c3f #
fn c3f(r f32, g f32, b f32)
fn c4b #
fn c4b(r u8, g u8, b u8, a u8)
fn c4f #
fn c4f(r f32, g f32, b f32, a f32)
fn context_draw #
fn context_draw(ctx Context)
fn context_error #
fn context_error(ctx Context) SglError
fn context_make_pipeline #
fn context_make_pipeline(ctx Context, desc &gfx.PipelineDesc) Pipeline
fn default_context #
fn default_context() Context
fn default_pipeline #
fn default_pipeline()
fn defaults #
fn defaults()
render state functions
fn deg #
fn deg(rad f32) f32
fn destroy_context #
fn destroy_context(ctx Context)
fn destroy_pipeline #
fn destroy_pipeline(pip Pipeline)
fn disable_texture #
fn disable_texture()
fn draw #
fn draw()
render recorded commands
fn enable_texture #
fn enable_texture()
fn end #
fn end()
fn error #
fn error() SglError
fn frustum #
fn frustum(l f32, r f32, b f32, t f32, n f32, f f32)
fn get_context #
fn get_context() Context
fn load_default_pipeline #
fn load_default_pipeline()
pipeline stack functions
fn load_identity #
fn load_identity()
fn load_matrix #
fn load_matrix(m []f32)
fn load_pipeline #
fn load_pipeline(pip Pipeline)
fn load_transpose_matrix #
fn load_transpose_matrix(m []f32)
fn lookat #
fn lookat(eye_x f32, eye_y f32, eye_z f32, center_x f32, center_y f32, center_z f32, up_x f32, up_y f32,
	up_z f32)
fn make_context #
fn make_context(desc &ContextDesc) Context
context functions
fn make_pipeline #
fn make_pipeline(desc &gfx.PipelineDesc) Pipeline
create and destroy pipeline objects
fn matrix_mode_modelview #
fn matrix_mode_modelview()
matrix stack functions
fn matrix_mode_projection #
fn matrix_mode_projection()
fn matrix_mode_texture #
fn matrix_mode_texture()
fn mult_matrix #
fn mult_matrix(m []f32)
fn mult_transpose_matrix #
fn mult_transpose_matrix(m []f32)
fn ortho #
fn ortho(l f32, r f32, b f32, t f32, n f32, f f32)
fn perspective #
fn perspective(fov_y f32, aspect f32, z_near f32, z_far f32)
fn point_size #
fn point_size(s f32)
fn pop_matrix #
fn pop_matrix()
fn pop_pipeline #
fn pop_pipeline()
fn push_matrix #
fn push_matrix()
fn push_pipeline #
fn push_pipeline()
fn rad #
fn rad(deg f32) f32
fn rotate #
fn rotate(angle_rad f32, x f32, y f32, z f32)
fn scale #
fn scale(x f32, y f32, z f32)
fn scissor_rect #
fn scissor_rect(x int, y int, w int, h int, origin_top_left bool)
fn scissor_rectf #
fn scissor_rectf(x f32, y f32, w f32, h f32, origin_top_left bool)
fn set_context #
fn set_context(ctx Context)
fn setup #
fn setup(desc &Desc)
setup/shutdown/misc
fn shutdown #
fn shutdown()
fn t2f #
fn t2f(u f32, v f32)
these functions only set the internal 'current texcoord / color' (valid inside or outside begin/end)
fn texture #
fn texture(img gfx.Image, smp gfx.Sampler)
fn translate #
fn translate(x f32, y f32, z f32)
fn v2f #
fn v2f(x f32, y f32)
fn v2f_c1i #
fn v2f_c1i(x f32, y f32, rgba u32)
fn v2f_c3b #
fn v2f_c3b(x f32, y f32, r u8, g u8, b u8)
fn v2f_c3f #
fn v2f_c3f(x f32, y f32, r f32, g f32, b f32)
fn v2f_c4b #
fn v2f_c4b(x f32, y f32, r u8, g u8, b u8, a u8)
fn v2f_c4f #
fn v2f_c4f(x f32, y f32, r f32, g f32, b f32, a f32)
fn v2f_t2f #
fn v2f_t2f(x f32, y f32, u f32, v f32)
fn v2f_t2f_c1i #
fn v2f_t2f_c1i(x f32, y f32, u f32, v f32, rgba u32)
fn v2f_t2f_c3b #
fn v2f_t2f_c3b(x f32, y f32, u f32, v f32, r u8, g u8, b u8)
fn v2f_t2f_c3f #
fn v2f_t2f_c3f(x f32, y f32, u f32, v f32, r f32, g f32, b f32)
fn v2f_t2f_c4b #
fn v2f_t2f_c4b(x f32, y f32, u f32, v f32, r u8, g u8, b u8, a u8)
fn v2f_t2f_c4f #
fn v2f_t2f_c4f(x f32, y f32, u f32, v f32, r f32, g f32, b f32, a f32)
fn v3f #
fn v3f(x f32, y f32, z f32)
fn v3f_c1i #
fn v3f_c1i(x f32, y f32, z f32, rgba u32)
fn v3f_c3b #
fn v3f_c3b(x f32, y f32, z f32, r u8, g u8, b u8)
fn v3f_c3f #
fn v3f_c3f(x f32, y f32, z f32, r f32, g f32, b f32)
fn v3f_c4b #
fn v3f_c4b(x f32, y f32, z f32, r u8, g u8, b u8, a u8)
fn v3f_c4f #
fn v3f_c4f(x f32, y f32, z f32, r f32, g f32, b f32, a f32)
fn v3f_t2f #
fn v3f_t2f(x f32, y f32, z f32, u f32, v f32)
fn v3f_t2f_c1i #
fn v3f_t2f_c1i(x f32, y f32, z f32, u f32, v f32, rgba u32)
fn v3f_t2f_c3b #
fn v3f_t2f_c3b(x f32, y f32, z f32, u f32, v f32, r u8, g u8, b u8)
fn v3f_t2f_c3f #
fn v3f_t2f_c3f(x f32, y f32, z f32, u f32, v f32, r f32, g f32, b f32)
fn v3f_t2f_c4b #
fn v3f_t2f_c4b(x f32, y f32, z f32, u f32, v f32, r u8, g u8, b u8, a u8)
fn v3f_t2f_c4f #
fn v3f_t2f_c4f(x f32, y f32, z f32, u f32, v f32, r f32, g f32, b f32, a f32)
fn viewport #
fn viewport(x int, y int, w int, h int, origin_top_left bool)
type Context #
type Context = C.sgl_context
type ContextDesc #
type ContextDesc = C.sgl_context_desc_t
ContextDesc
Describes the initialization parameters of a rendering context. Creating additional contexts is useful if you want to render in separate sokol-gfx passes. ContextDesc is sgl_context_desc_t
type Desc #
type Desc = C.sgl_desc_t
type Pipeline #
type Pipeline = C.sgl_pipeline
enum SglError #
enum SglError {
	no_error        = C.SGL_NO_ERROR // 0
	vertices_full   = C.SGL_ERROR_VERTICES_FULL
	uniforms_full   = C.SGL_ERROR_UNIFORMS_FULL
	commands_full   = C.SGL_ERROR_COMMANDS_FULL
	stack_overflow  = C.SGL_ERROR_STACK_OVERFLOW
	stack_underflow = C.SGL_ERROR_STACK_UNDERFLOW
	no_context      = C.SGL_ERROR_NO_CONTEXT
}
SglError is C.sgl_error_t
struct C.sgl_allocator_t #
@[typedef]
struct C.sgl_allocator_t {
pub mut:
	alloc_fn  memory.FnAllocatorAlloc = unsafe { nil }
	free_fn   memory.FnAllocatorFree  = unsafe { nil }
	user_data voidptr
}
struct C.sgl_context #
@[typedef]
struct C.sgl_context {
	id u32
}
struct C.sgl_context_desc_t #
@[typedef]
struct C.sgl_context_desc_t {
	max_vertices int             // default: 64k
	max_commands int             // default: 16k
	color_format gfx.PixelFormat // C.sg_pixel_format
	depth_format gfx.PixelFormat // C.sg_pixel_format
	sample_count int
}
struct C.sgl_desc_t #
@[typedef]
struct C.sgl_desc_t {
pub:
	max_vertices       int             // size for vertex buffer
	max_commands       int             // size of uniform- and command-buffers
	context_pool_size  int             // max number of contexts (including default context), default: 4
	pipeline_pool_size int             // size of internal pipeline pool, default: 64
	color_format       gfx.PixelFormat // C.sg_pixel_format
	depth_format       gfx.PixelFormat // C.sg_pixel_format
	sample_count       int
	face_winding       gfx.FaceWinding // C.sg_face_winding // default front face winding is CCW
pub mut:
	allocator C.sgl_allocator_t // optional memory allocation overrides (default: malloc/free)
	logger    C.sgl_logger_t    // optional memory allocation overrides (default: SOKOL_LOG(message))
}
struct C.sgl_logger_t #
@[typedef]
struct C.sgl_logger_t {
pub mut:
	func      memory.FnLogCb = unsafe { nil }
	user_data voidptr
}
struct C.sgl_pipeline #
@[typedef]
struct C.sgl_pipeline {
	id u32
}
- Constants
- fn begin_line_strip        
- fn begin_lines        
- fn begin_points        
- fn begin_quads        
- fn begin_triangle_strip        
- fn begin_triangles        
- fn c1i        
- fn c3b        
- fn c3f        
- fn c4b        
- fn c4f        
- fn context_draw        
- fn context_error        
- fn context_make_pipeline        
- fn default_context        
- fn default_pipeline        
- fn defaults        
- fn deg        
- fn destroy_context        
- fn destroy_pipeline        
- fn disable_texture        
- fn draw        
- fn enable_texture        
- fn end        
- fn error        
- fn frustum        
- fn get_context        
- fn load_default_pipeline        
- fn load_identity        
- fn load_matrix        
- fn load_pipeline        
- fn load_transpose_matrix        
- fn lookat        
- fn make_context        
- fn make_pipeline        
- fn matrix_mode_modelview        
- fn matrix_mode_projection        
- fn matrix_mode_texture        
- fn mult_matrix        
- fn mult_transpose_matrix        
- fn ortho        
- fn perspective        
- fn point_size        
- fn pop_matrix        
- fn pop_pipeline        
- fn push_matrix        
- fn push_pipeline        
- fn rad        
- fn rotate        
- fn scale        
- fn scissor_rect        
- fn scissor_rectf        
- fn set_context        
- fn setup        
- fn shutdown        
- fn t2f        
- fn texture        
- fn translate        
- fn v2f        
- fn v2f_c1i        
- fn v2f_c3b        
- fn v2f_c3f        
- fn v2f_c4b        
- fn v2f_c4f        
- fn v2f_t2f        
- fn v2f_t2f_c1i        
- fn v2f_t2f_c3b        
- fn v2f_t2f_c3f        
- fn v2f_t2f_c4b        
- fn v2f_t2f_c4f        
- fn v3f        
- fn v3f_c1i        
- fn v3f_c3b        
- fn v3f_c3f        
- fn v3f_c4b        
- fn v3f_c4f        
- fn v3f_t2f        
- fn v3f_t2f_c1i        
- fn v3f_t2f_c3b        
- fn v3f_t2f_c3f        
- fn v3f_t2f_c4b        
- fn v3f_t2f_c4f        
- fn viewport        
- type Context        
- type ContextDesc        
- type Desc        
- type Pipeline        
- enum SglError        
- struct C.sgl_allocator_t        
- struct C.sgl_context        
- struct C.sgl_context_desc_t        
- struct C.sgl_desc_t        
- struct C.sgl_logger_t        
- struct C.sgl_pipeline