OpenGL (Open Graphics Library) is a API for rendering 2D and 3D graphics. It's is available in a number of versions and on many platforms. These pages aim for version 4.3.

The Basic Stuff

The statemachine

OpenGl is a state machine and the state is stored in the context of OpenGL and the objects created in the context. By using functions you can modify the state in the context or the objects and by setting objects as active you can change many states at the same time. When drawing something it is using the current state to decide what shows up on the screen. Opengl objects are namned using GLuint values. Values are reserved using the glGen* and deleted with dlDelete*. The resulting name can be any value besides 0 and they are used with glBind*. There is also a function glIs* that can be used to check if a opengl object is of a specific type.

void glGen*(GLsizei n​, GLuint *arrays​);

GLboolean glIs*(GLuint array​);

void glBind*(GLuint array​);

void glDelete*(GLsizei n​, const GLuint *arrays​);

The Interface

OpenGL use the prefix gl for OpenGL commands. Constants begin with GL_ and use all capital letters. Some functions comes in many versions and they then use suffix to specify the number of arguments and the return type. Ex glColor3f takes 3 floats and glColor4d takes four double.

The Extensions

OpenGL Extensions - 2012

Sad facts about OpenGL extension libraries - 2010


    • Buffers: Buffer objects are used to store data that one use in or get from opengl.

    • Textures: Contains one or more images and are used from shaders or used as a render target.

    • Shaders:

    • GLSL: The shading language used in OpenGL.

    • Drawing: Rendering can be indexed (*elements) or non-indexed (*arrays).

    • Framebuffer: Select what to draw to.




Did you arrive from DirectX?


WebGL + Rust: Basic Water Tutorial - 2019

Volume Rendering with WebGL - 2019

OpenGL Renderer Design - 2016

Reversed-Z in OpenGL - 2016

OpenGL like Vulkan - 2016

GPU-Driven Large Scene Rendering in OpenGL - 2015

Bringing Unreal Engine 4 To Opengl (video) (slides) - 2014

Moving Your Games to OpenGL - 2014

OpenGL Scene Rendering Techniques - 2014

Quad Meshes - 2013

Clip Planes - 2012

Modern OpenGL - 2012

OpenGL vs DirectX: The War Is Far From Over - 2011

Unit testing OpenGL applications - 2010

Going mobile with OpenGL ES - 2010

An introduction to OpenGL 4.1 - 2010

A brief preview of the new features introduced by OpenGL 3.3 and 4.0 - 2010


Emulating Command Buffers in OpenGL - 2019 : Part 1 & Part 2

Alpha compositing, OpenGL blending and premultiplied alpha - 2015

Porting from DirectX11 to OpenGL 4.2: API mapping - 2013

Porting from DirectX11 to OpenGL 4.2: Tales from the trenches - 2013

Porting from DirectX11 to OpenGL 4.2: Textures & samplers - 2013

Modern openGl - 2012

Instance culling using geometry shaders - 2010

Uniform Buffers VS Texture Buffers - 2010

A brief preview of the new features introduced by OpenGL 3.3 and 4.0 - 2010

Instance Cloud Reduction reloaded - 2010

The history of opengl vertex data

Clip Planes

Strings Inside Vertex Buffers

How powerful can WebGL be in comparison with native OpenGL?

Raw OpenGL

Instanced Line Rendering - 2019

WebGL/WebGPU/three.js Resources

Learn OpenGL

[video] Spot lights in OpenGL

[video] Specular Lighting in OpenGL

[video] Skeletal Animation In OpenGL using Assimp - Part 2

Skeletal Animation In OpenGL using Assimp - Part 1

From GLSL to WGSL: the future of shaders on the Web

WebGPU Best Practices



Clipping and viewport mapping in OpenGL

Modern OpenGL Tutorial - Tessellation Shaders

How to Select 3D Objects With The Mouse Using OpenGL

Modern OpenGL - Compute Shaders