graphics-snippets

StackOverflow

“The only way to go fast, is to go well.”
Robert C. Martin, Clean Architecture


C++

C++ code snippets

Hello Triangle

Hello Triangle - GLFW

Thick lines

Thick lines with OpenGL core profile

thick line strip ssbo
thick_line_strip_ssbo

thick line, geometry shader
thick line, geometry shader

Dashed lines

Dashed line shader

dashed_line_segments
dashed_line_strip
stippled_line_segments
Dashed line shader

stippled_line_gllinestipple
stippled_line_fixedattribute_glLineStipple
stippled_line_fixedattribute_texture_alpha_OpenGLES100
stippled_line_shader
stippled_line_shader

Platonic solid

Wikipedia - Platonic solid

In three-dimensional space, a Platonic solid is a regular, convex polyhedron. It is constructed by congruent (identical in shape and size), regular (all angles equal and all sides equal), polygonal faces with the same number of faces meeting at each vertex. Five solids meet these criteria.

Platonic solid
stippled_line_shader

Navigate

example_navigate_1_orbit
example_navigate_1_orbit

Rubik’s Cube

rubiks_cube_glfw

OpenGL 4 Examples

example_glm_animation_1
example_glm_animation_1


example_mesh_1_instancing
example_mesh_1_instancing


example_mesh_3_c_cube
example_mesh_3_c_cube


example_mesh_4_cube_flat
example_mesh_4_cube_flat


example_mesh_5
example_mesh_5


example_mesh_7_raytrace
example_mesh_7_raytrace


example_mesh_8_surface_of_revolution
example_mesh_8_surface_of_revolution


example_noise_1
example_noise_1


example_freeglut_text_freetype
example_freeglut_text_freetype


example_glfw_text_freetype
example_glfw_text_freetype


Immediate mode (Legacy) OpenGL examples

example_beginend_cube
example_beginend_freeglut_1
example_beginend_shader_1
example_beginend_cube


example_fixedattribute_cube_1
example_fixedattribute_cube_1


example_fixedattribute_sphere_1_slices
example_fixedattribute_sphere_1_slices


example_glu_sphere_1
example_glu_sphere_1

Emscripten examples

emscripten

Emscrpten OpenGL ES 2.0 triangle      Preview

Emscrpten OpenGL ES 3.0 triangle      Preview