Reference
CGP is mostly made of free functions (norm(v), draw(drawable, environment)) rather than methods: each type page lists what you can do with the type, grouped by intent. The functions written once for every size of vector or matrix are on the pages vecN and matN.
Vectors and matrices
vecNOperations shared by all vectors (vec2, vec3, vec4), written once for any size.applies to vec2, vec3, vec446 functionsmatNOperations shared by all matrices (mat2, mat3, mat4), written once for any size.applies to mat2, mat3, mat432 functionsvec22D vector of floats.61 functionsvec33D vector of floats (positions, directions, colors).97 functionsvec44D vector of floats (homogeneous coordinates, RGBA).57 functionsmat22x2 matrix of floats.37 functionsmat33x3 matrix of floats (rotations, linear maps).44 functionsmat44x4 matrix of floats (affine and projective transforms).60 functionsScalar math and comparisonsabs, clamp and linear interpolation of numbers, and comparisons with a tolerance.24 functionsRandom numbers and noiseUniform and normal random numbers, and Perlin-like noise for procedural shapes.4 functions
Transforms
quaternionQuaternion, used to represent rotations.73 functionsrotation_transform3D rotation (stored as a unit quaternion).21 functionsaffine_rtRigid transform: rotation + translation.24 functionsaffine_rtsSimilarity transform: rotation + translation + uniform scaling.27 functionsaffineAffine transform made of a rotation, uniform and per-axis scalings, and a translation (no shear).13 functionsframeLocal coordinate frame.8 functions
Containers
numarrayDynamic-size array with numerical operations.52 functionsgrid_2D2D grid container (dynamic size).28 functionsgrid_3D3D grid container (dynamic size).25 functionsGrid helpersOffsets between 2D/3D indices and linear storage, and operations on fixed-size grids.28 functions
Meshes and drawables
meshTriangle mesh stored on the CPU (positions, normals, colors, uv, connectivity).21 functionsmesh_drawableMesh stored on the GPU (VBOs, shader, texture, model transform), ready to be drawn.2 functionscurve_drawablePolyline stored on the GPU, ready to be drawn.1 functionshierarchy_mesh_drawableTree of mesh_drawable elements, each placed relative to its parent (articulated objects).2 functionshierarchy_mesh_drawable_nodeOne element of a hierarchy_mesh_drawable (drawable, parent name, local and global transforms).0 functionstriangles_drawableTriangle soup stored on the GPU, without connectivity, ready to be drawn.2 functionstrajectory_drawableTrail of the last positions of a moving point, drawn as a curve.1 functionscurve_drawable_dynamic_extendcurve_drawable whose number of points can grow while the program runs (sketching).2 functionsskybox_drawableCube map drawn around the camera as a background.1 functionsmaterial_mesh_drawable_phongMaterial of a mesh_drawable (color, alpha, Phong coefficients, texture settings).2 functionsphong_parametersPhong coefficients of a material: ambient, diffuse, specular and specular exponent.0 functionstexture_settings_parametersTexture options of a material (use the texture, flip v, two-sided lighting).0 functionsbounding_boxAxis-aligned bounding box (corners p_min and p_max) of a mesh or a set of points.0 functionsMarching cubesExtract a triangle mesh from a scalar field sampled on a grid, and the lookup tables.5 functionsOBJ filesRead the parts of an OBJ file, load a model with several materials, save a mesh.6 functions
Images and OpenGL
image_structureImage stored on the CPU (width, height, RGB/RGBA data).8 functionsopengl_shader_structureOpenGL shader program.12 functionsopengl_texture_image_structureOpenGL texture.0 functionsopengl_fbo_structureOff-screen frame buffer, to render into a texture (color or depth).0 functionsuniform_generic_structureNamed uniform values (int, float, vec3, mat4...) sent to every shader.6 functionsopengl_vbo_structureOpenGL vertex buffer (VBO) holding one per-vertex or per-instance array of vec2, vec3 or vec4.1 functionsopengl_ebo_structureOpenGL element buffer (EBO) holding the triangle indices (uint3) of an indexed mesh.0 functionsopengl_gpu_bufferCommon base of the VBO and the EBO - OpenGL id, number of elements, target and memory layout.0 functionsOpenGL, window and GUI helpersOpenGL error checks and low-level buffers, ImGui frame functions, WebGL window helpers.11 functions
Camera and scene
camera_orbitCamera orbiting around a center of rotation.3 functionscamera_projection_perspectivePerspective projection parameters (field of view, aspect ratio, near/far planes).3 functionsenvironment_generic_structureEnvironment shared by all draw calls (camera, projection, light, uniforms).10 functionscamera_orbit_eulerCamera orbiting around a center, oriented by two angles (keeps the up direction).3 functionscamera_first_personCamera with a free position and orientation (first person view).3 functionscamera_first_person_eulerFirst person camera oriented by yaw and pitch angles (keeps the up direction).3 functionscamera_projection_orthographicOrthographic projection parameters (box seen by the camera, no perspective).0 functionscamera_controller_orbitMouse and keyboard control of a camera_orbit (rotate, zoom, pan).0 functionscamera_controller_orbit_eulerMouse and keyboard control of a camera_orbit_euler (default camera of the scene template).0 functionscamera_controller_first_personMouse and keyboard control of a camera_first_person.0 functionscamera_controller_first_person_eulerMouse and keyboard control of a camera_first_person_euler (walk in a scene).0 functionscamera_controller_fly_modePlane-like camera control moving forward continuously.0 functionsinput_devicesState of the mouse, the keyboard and the time step, updated by the application.0 functionsinputs_keyboard_parametersKeyboard state (inputs.keyboard) with is_pressed(key) and the shift, ctrl and arrow flags.0 functionsinputs_keyboard_last_action_parameterLast key pressed or released (inputs.keyboard.last_action), to react once to a key press.0 functionsinputs_mouse_parametersMouse state (inputs.mouse) with the cursor position, the buttons, the scroll and the GUI flag.0 functionspicking_structureResult of a picking (picking_spheres...) with the selected index, the 3D position and the ray.2 functionsintersection_structureResult of a ray intersection (valid flag, position and normal of the hit point).4 functionswindow_structureGLFW window of the application (size, title, aspect ratio).0 functions
Time and animation
timer_basicTimer accumulating the elapsed time t (update() returns the time step), with start, stop and a speed factor.0 functionstimer_intervalTimer looping over a time interval [t_min, t_max] (periodic animations).0 functionstimer_event_periodicTimer raising an event at a fixed period (spawn objects regularly).0 functionsTimeClock shared by all the timers.2 functions
Utilities
Functions that take or return none of the types of the reference.
Strings and textConvert values and types to strings (str, type_str), change the case, pad with zeros.41 functionsFiles and pathsRead text and binary files, check that a path exists, find the project folder.14 functionsErrors and memoryReport errors and warnings, size in memory and raw pointer of the base types.42 functions