OpenGl

glEnable(GL_EPIC);


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

Guide

    • 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.

Links

Tutorials

Effects

Did you arrive from DirectX?

Reference

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

Software

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

http://www.realtimerendering.com/webgl.html


Learn OpenGL

https://learnopengl.com/


[video] Spot lights in OpenGL

https://www.youtube.com/watch?v=MAJqiDll0a8


[video] Specular Lighting in OpenGL

https://www.youtube.com/watch?v=dJo1Ao9XydM


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

https://www.youtube.com/watch?v=pb6KZPaDBBY


Skeletal Animation In OpenGL using Assimp - Part 1

https://www.youtube.com/watch?v=r6Yv_mh79PI


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

https://dmnsgn.medium.com/from-glsl-to-wgsl-the-future-of-shaders-on-the-web-bebc0c3df5c0


WebGPU Best Practices

https://docs.google.com/presentation/d/1Q-RCJrZhw9nlZ5py7QxUVgKSyq61awHr2TyIjXxBmI0/edit#slide=id.p


HOW TO DEBUG Your OpenGL Code

https://www.youtube.com/watch?v=Wk145_jUsBk&feature=youtu.be


HOW TO DEBUG Your OpenGL Code

https://www.youtube.com/watch?v=Wk145_jUsBk&feature=youtu.be


Clipping and viewport mapping in OpenGL

https://www.youtube.com/watch?v=J5Tqvs6RzGs


Modern OpenGL Tutorial - Tessellation Shaders

https://www.youtube.com/watch?v=21gfE-zUym8


How to Select 3D Objects With The Mouse Using OpenGL

https://www.youtube.com/watch?v=71G-PVpaVk8


Modern OpenGL - Compute Shaders

https://www.youtube.com/watch?v=nF4X9BIUzx0