*[sample-primitives.c](https://github.com/edubart/sokol_gp/blob/master/samples/sample-primitives.c): This is an example showing all drawing primitives and transformations APIs.
*[sample-blend.c](https://github.com/edubart/sokol_gp/blob/master/samples/sample-blend.c): This is an example showing all blend modes between 3 rectangles.
*[sample-framebuffer.c](https://github.com/edubart/sokol_gp/blob/master/samples/sample-framebuffer.c): This is an example showing how to use multiple `sgp_begin()` with frame buffers.
*[sample-sdf.c](https://github.com/edubart/sokol_gp/blob/master/samples/sample-sdf.c): This is an example on how to create custom shaders.
*[sample-effect.c](https://github.com/edubart/sokol_gp/blob/master/samples/sample-effect.c): This is an example on how to use custom shaders for 2D drawing.
*[sample-bench.c](https://github.com/edubart/sokol_gp/blob/master/samples/sample-bench.c): This is a heavy example used for benchmarking purposes.
/* Structure that defines SGP setup parameters. */
typedefstructsgp_desc{
uint32_tmax_vertices;
uint32_tmax_commands;
sg_pixel_formatcolor_format;/* Color format for creating pipelines, defaults to the same as the Sokol GFX context. */
sg_pixel_formatdepth_format;/* Depth format for creating pipelines, defaults to the same as the Sokol GFX context. */
intsample_count;/* Sample count for creating pipelines, defaults to the same as the Sokol GFX context. */
}sgp_desc;
/* Structure that defines SGP custom pipeline creation parameters. */
typedefstructsgp_pipeline_desc{
sg_shadershader;/* Sokol shader. */
sg_primitive_typeprimitive_type;/* Draw primitive type (triangles, lines, points, etc). Default is triangles. */
sgp_blend_modeblend_mode;/* Color blend mode. Default is no blend. */
sg_pixel_formatcolor_format;/* Color format, defaults to the value used when creating Sokol GP context. */
sg_pixel_formatdepth_format;/* Depth format, defaults to the value used when creating Sokol GP context. */
intsample_count;/* Sample count, defaults to the value used when creating Sokol GP context. */
boolhas_vs_color;/* If true, the current color state will be passed as an attribute to the vertex shader. */
}sgp_pipeline_desc;
/* Initialization and de-initialization. */
SOKOL_GP_API_DECLvoidsgp_setup(constsgp_desc*desc);/* Initializes the SGP context, and should be called after `sg_setup`. */
SOKOL_GP_API_DECLvoidsgp_shutdown(void);/* Destroys the SGP context. */
SOKOL_GP_API_DECLboolsgp_is_valid(void);/* Checks if SGP context is valid, should be checked after `sgp_setup`. */
/* Error handling. */
SOKOL_GP_API_DECLsgp_errorsgp_get_last_error(void);/* Returns last SGP error. */
SOKOL_GP_API_DECLconstchar*sgp_get_error_message(sgp_errorerror);/* Returns a message with SGP error description. */
/* Custom pipeline creation. */
SOKOL_GP_API_DECLsg_pipelinesgp_make_pipeline(constsgp_pipeline_desc*desc);/* Creates a custom shader pipeline to be used with SGP. */
/* Draw command queue management. */
SOKOL_GP_API_DECLvoidsgp_begin(intwidth,intheight);/* Begins a new SGP draw command queue. */
SOKOL_GP_API_DECLvoidsgp_flush(void);/* Dispatch current Sokol GFX draw commands. */
SOKOL_GP_API_DECLvoidsgp_end(void);/* End current draw command queue, discarding it. */
/* 2D coordinate space projection */
SOKOL_GP_API_DECLvoidsgp_project(floatleft,floatright,floattop,floatbottom);/* Set the coordinate space boundary in the current viewport. */
SOKOL_GP_API_DECLvoidsgp_reset_project(void);/* Resets the coordinate space to default (coordinate of the viewport). */
/* 2D coordinate space transformation. */
SOKOL_GP_API_DECLvoidsgp_push_transform(void);/* Saves current transform matrix, to be restored later with a pop. */
SOKOL_GP_API_DECLvoidsgp_pop_transform(void);/* Restore transform matrix to the same value of the last push. */
SOKOL_GP_API_DECLvoidsgp_reset_transform(void);/* Resets the transform matrix to identity (no transform). */
SOKOL_GP_API_DECLvoidsgp_translate(floatx,floaty);/* Translates the 2D coordinate space. */
SOKOL_GP_API_DECLvoidsgp_rotate(floattheta);/* Rotates the 2D coordinate space around the origin. */
SOKOL_GP_API_DECLvoidsgp_rotate_at(floattheta,floatx,floaty);/* Rotates the 2D coordinate space around a point. */
SOKOL_GP_API_DECLvoidsgp_scale(floatsx,floatsy);/* Scales the 2D coordinate space around the origin. */
SOKOL_GP_API_DECLvoidsgp_scale_at(floatsx,floatsy,floatx,floaty);/* Scales the 2D coordinate space around a point. */
/* State change for custom pipelines. */
SOKOL_GP_API_DECLvoidsgp_set_pipeline(sg_pipelinepipeline);/* Sets current draw pipeline. */
SOKOL_GP_API_DECLvoidsgp_reset_pipeline(void);/* Resets to the current draw pipeline to default (builtin pipelines). */
SOKOL_GP_API_DECLvoidsgp_set_uniform(constvoid*vs_data,uint32_tvs_size,constvoid*fs_data,uint32_tfs_size);/* Sets uniform buffer for a custom pipeline. */
SOKOL_GP_API_DECLvoidsgp_reset_uniform(void);/* Resets uniform buffer to default (current state color). */
/* State change functions for the common pipelines. */
SOKOL_GP_API_DECLvoidsgp_set_blend_mode(sgp_blend_modeblend_mode);/* Sets current blend mode. */
SOKOL_GP_API_DECLvoidsgp_reset_blend_mode(void);/* Resets current blend mode to default (no blending). */
SOKOL_GP_API_DECLvoidsgp_set_color(floatr,floatg,floatb,floata);/* Sets current color modulation. */
SOKOL_GP_API_DECLvoidsgp_reset_color(void);/* Resets current color modulation to default (white). */
SOKOL_GP_API_DECLvoidsgp_set_image(intchannel,sg_imageimage);/* Sets current bound image in a texture channel. */
SOKOL_GP_API_DECLvoidsgp_unset_image(intchannel);/* Remove current bound image in a texture channel (no texture). */
SOKOL_GP_API_DECLvoidsgp_reset_image(intchannel);/* Resets current bound image in a texture channel to default (white texture). */
SOKOL_GP_API_DECLvoidsgp_set_sampler(intchannel,sg_samplersampler);/* Sets current bound sampler in a texture channel. */
SOKOL_GP_API_DECLvoidsgp_reset_sampler(intchannel);/* Resets current bound sampler in a texture channel to default (nearest sampler). */
/* State change functions for all pipelines. */
SOKOL_GP_API_DECLvoidsgp_viewport(intx,inty,intw,inth);/* Sets the screen area to draw into. */
SOKOL_GP_API_DECLvoidsgp_scissor(intx,inty,intw,inth);/* Set clip rectangle in the viewport. */
SOKOL_GP_API_DECLvoidsgp_reset_scissor(void);/* Resets clip rectangle to default (viewport bounds). */
SOKOL_GP_API_DECLvoidsgp_reset_state(void);/* Reset all state to default values. */
/* Drawing functions. */
SOKOL_GP_API_DECLvoidsgp_clear(void);/* Clears the current viewport using the current state color. */
SOKOL_GP_API_DECLvoidsgp_draw(sg_primitive_typeprimitive_type,constsgp_vertex*vertices,uint32_tcount);/* Low level drawing function, capable of drawing any primitive. */
SOKOL_GP_API_DECLvoidsgp_draw_points(constsgp_point*points,uint32_tcount);/* Draws points in a batch. */
SOKOL_GP_API_DECLvoidsgp_draw_point(floatx,floaty);/* Draws a single point. */
SOKOL_GP_API_DECLvoidsgp_draw_lines(constsgp_line*lines,uint32_tcount);/* Draws lines in a batch. */
SOKOL_GP_API_DECLvoidsgp_draw_line(floatax,floatay,floatbx,floatby);/* Draws a single line. */
SOKOL_GP_API_DECLvoidsgp_draw_lines_strip(constsgp_point*points,uint32_tcount);/* Draws a strip of lines. */
SOKOL_GP_API_DECLvoidsgp_draw_filled_triangles(constsgp_triangle*triangles,uint32_tcount);/* Draws triangles in a batch. */
SOKOL_GP_API_DECLvoidsgp_draw_filled_triangle(floatax,floatay,floatbx,floatby,floatcx,floatcy);/* Draws a single triangle. */
SOKOL_GP_API_DECLvoidsgp_draw_filled_triangles_strip(constsgp_point*points,uint32_tcount);/* Draws strip of triangles. */
SOKOL_GP_API_DECLvoidsgp_draw_filled_rects(constsgp_rect*rects,uint32_tcount);/* Draws a batch of rectangles. */
SOKOL_GP_API_DECLvoidsgp_draw_filled_rect(floatx,floaty,floatw,floath);/* Draws a single rectangle. */
SOKOL_GP_API_DECLvoidsgp_draw_textured_rects(intchannel,constsgp_textured_rect*rects,uint32_tcount);/* Draws a batch textured rectangle, each from a source region. */
SOKOL_GP_API_DECLvoidsgp_draw_textured_rect(intchannel,sgp_rectdest_rect,sgp_rectsrc_rect);/* Draws a single textured rectangle from a source region. */
/* Querying functions. */
SOKOL_GP_API_DECLsgp_state*sgp_query_state(void);/* Returns the current draw state. */
SOKOL_GP_API_DECLsgp_descsgp_query_desc(void);/* Returns description of the current SGP context. */