Module sokol.sgl stdlib

sokol.sgl
Version:
0.3.3
License:
MIT
Dependencies from vmod:
0
Imports:
2
Imported by:
4
Repository:
OS-specific
Show selected OS-specific symbols.
Backend-specific
Show selected Backend-specific symbols.

Dependencies defined in v.mod

This section is empty.

Imports

Imported by

Aliases

#type Pipeline

type Pipeline = C.sgl_pipeline

#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

Constants

#constant version

pub const version = gfx.version + 1

#constant context

pub const context = Context{0x00010001} // C.SGL_DEFAULT_CONTEXT = { 0x00010001 }

Sum types

This section is empty.

Functions

#fn begin_line_strip

inline
fn begin_line_strip()

#fn begin_lines

inline
fn begin_lines()

#fn begin_points

inline
fn begin_points()

define primitives, each begin/end is one draw command

#fn begin_quads

inline
fn begin_quads()

#fn begin_triangle_strip

inline
fn begin_triangle_strip()

#fn begin_triangles

inline
fn begin_triangles()

#fn c1i

inline
fn c1i(rgba u32)

#fn c3b

inline
fn c3b(r u8, g u8, b u8)

#fn c3f

inline
fn c3f(r f32, g f32, b f32)

#fn c4b

inline
fn c4b(r u8, g u8, b u8, a u8)

#fn c4f

inline
fn c4f(r f32, g f32, b f32, a f32)

#fn context_draw

inline
fn context_draw(ctx Context)

#fn context_error

inline
fn context_error(ctx Context) SglError

#fn context_make_pipeline

inline
fn context_make_pipeline(ctx Context, desc &sokol.gfx.PipelineDesc) Pipeline

#fn default_context

inline
fn default_context() Context

#fn default_pipeline

inline
fn default_pipeline()

#fn defaults

inline
fn defaults()

render state functions

#fn deg

inline
fn deg(rad f32) f32

#fn destroy_context

inline
fn destroy_context(ctx Context)

#fn destroy_pipeline

inline
fn destroy_pipeline(pip Pipeline)

#fn disable_texture

inline
fn disable_texture()

#fn draw

inline
fn draw()

render recorded commands

#fn enable_texture

inline
fn enable_texture()

#fn end

inline
fn end()

#fn error

inline
fn error() SglError

#fn frustum

inline
fn frustum(l f32, r f32, b f32, t f32, n f32, f f32)

#fn get_context

inline
fn get_context() Context

#fn load_default_pipeline

inline
fn load_default_pipeline()

pipeline stack functions

#fn load_identity

inline
fn load_identity()

#fn load_matrix

inline
fn load_matrix(m []f32)

#fn load_pipeline

inline
fn load_pipeline(pip Pipeline)

#fn load_transpose_matrix

inline
fn load_transpose_matrix(m []f32)

#fn lookat

inline
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

inline
fn make_context(desc &ContextDesc) Context

context functions

#fn make_pipeline

inline
fn make_pipeline(desc &sokol.gfx.PipelineDesc) Pipeline

create and destroy pipeline objects

#fn matrix_mode_modelview

inline
fn matrix_mode_modelview()

matrix stack functions

#fn matrix_mode_projection

inline
fn matrix_mode_projection()

#fn matrix_mode_texture

inline
fn matrix_mode_texture()

#fn mult_matrix

inline
fn mult_matrix(m []f32)

#fn mult_transpose_matrix

inline
fn mult_transpose_matrix(m []f32)

#fn ortho

inline
fn ortho(l f32, r f32, b f32, t f32, n f32, f f32)

#fn perspective

inline
fn perspective(fov_y f32, aspect f32, z_near f32, z_far f32)

#fn point_size

inline
fn point_size(s f32)

#fn pop_matrix

inline
fn pop_matrix()

#fn pop_pipeline

inline
fn pop_pipeline()

#fn push_matrix

inline
fn push_matrix()

#fn push_pipeline

inline
fn push_pipeline()

#fn rad

inline
fn rad(deg f32) f32

#fn rotate

inline
fn rotate(angle_rad f32, x f32, y f32, z f32)

#fn scale

inline
fn scale(x f32, y f32, z f32)

#fn scissor_rect

inline
fn scissor_rect(x int, y int, w int, h int, origin_top_left bool)

#fn scissor_rectf

inline
fn scissor_rectf(x f32, y f32, w f32, h f32, origin_top_left bool)

#fn set_context

inline
fn set_context(ctx Context)

#fn setup

fn setup(desc &Desc)

setup/shutdown/misc

#fn shutdown

fn shutdown()

#fn t2f

inline
fn t2f(u f32, v f32)

these functions only set the internal 'current texcoord / color' (valid inside or outside begin/end)

#fn texture

inline
fn texture(img sokol.gfx.Image)

#fn translate

inline
fn translate(x f32, y f32, z f32)

#fn v2f

inline
fn v2f(x f32, y f32)

#fn v2f_c1i

inline
fn v2f_c1i(x f32, y f32, rgba u32)

#fn v2f_c3b

inline
fn v2f_c3b(x f32, y f32, r u8, g u8, b u8)

#fn v2f_c3f

inline
fn v2f_c3f(x f32, y f32, r f32, g f32, b f32)

#fn v2f_c4b

inline
fn v2f_c4b(x f32, y f32, r u8, g u8, b u8, a u8)

#fn v2f_c4f

inline
fn v2f_c4f(x f32, y f32, r f32, g f32, b f32, a f32)

#fn v2f_t2f

inline
fn v2f_t2f(x f32, y f32, u f32, v f32)

#fn v2f_t2f_c1i

inline
fn v2f_t2f_c1i(x f32, y f32, u f32, v f32, rgba u32)

#fn v2f_t2f_c3b

inline
fn v2f_t2f_c3b(x f32, y f32, u f32, v f32, r u8, g u8, b u8)

#fn v2f_t2f_c3f

inline
fn v2f_t2f_c3f(x f32, y f32, u f32, v f32, r f32, g f32, b f32)

#fn v2f_t2f_c4b

inline
fn v2f_t2f_c4b(x f32, y f32, u f32, v f32, r u8, g u8, b u8, a u8)

#fn v2f_t2f_c4f

inline
fn v2f_t2f_c4f(x f32, y f32, u f32, v f32, r f32, g f32, b f32, a f32)

#fn v3f

inline
fn v3f(x f32, y f32, z f32)

#fn v3f_c1i

inline
fn v3f_c1i(x f32, y f32, z f32, rgba u32)

#fn v3f_c3b

inline
fn v3f_c3b(x f32, y f32, z f32, r u8, g u8, b u8)

#fn v3f_c3f

inline
fn v3f_c3f(x f32, y f32, z f32, r f32, g f32, b f32)

#fn v3f_c4b

inline
fn v3f_c4b(x f32, y f32, z f32, r u8, g u8, b u8, a u8)

#fn v3f_c4f

inline
fn v3f_c4f(x f32, y f32, z f32, r f32, g f32, b f32, a f32)

#fn v3f_t2f

inline
fn v3f_t2f(x f32, y f32, z f32, u f32, v f32)

#fn v3f_t2f_c1i

inline
fn v3f_t2f_c1i(x f32, y f32, z f32, u f32, v f32, rgba u32)

#fn v3f_t2f_c3b

inline
fn v3f_t2f_c3b(x f32, y f32, z f32, u f32, v f32, r u8, g u8, b u8)

#fn v3f_t2f_c3f

inline
fn v3f_t2f_c3f(x f32, y f32, z f32, u f32, v f32, r f32, g f32, b f32)

#fn v3f_t2f_c4b

inline
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

inline
fn v3f_t2f_c4f(x f32, y f32, z f32, u f32, v f32, r f32, g f32, b f32, a f32)

#fn viewport

inline
fn viewport(x int, y int, w int, h int, origin_top_left bool)

Structs

#struct C.sgl_allocator_t

typedef
pub struct C.sgl_allocator_t {
pub mut:
	alloc     memory.FnAllocatorAlloc
	free      memory.FnAllocatorFree
	user_data voidptr
}

#struct C.sgl_logger_t

typedef
pub struct C.sgl_logger_t {
pub mut:
	log_cb    memory.FnLogCb
	user_data voidptr
}

#struct C.sgl_context_desc_t

typedef
pub 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
pub 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))
}

Interfaces

This section is empty.

Enums

#enum SglError

pub 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_underfloat = C.SGL_ERROR_STACK_UNDERFLOW
	no_context = C.SGL_ERROR_NO_CONTEXT
}

SglError is C.sgl_error_t