CGPdocs

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

Transforms

Containers

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

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

Utilities

Functions that take or return none of the types of the reference.

CGP - Computer Graphics Programming.