Create your own game
eng   рус

Rendering pipeline in OpenGL

Previous tutorial: OpenGL Hello World. OpenGL 4.6 First Program: GLFW, SDL2, GLEW
Next tutorial: OpenGL Basics and Triangle Rendering. Rendering Pipeline, Vertex and Fragment Shaders

In this tutorial we'll learn theory how OpenGL works and different steps of building (rendering) 2d image from initial data.

We'll talk about latest OpenGL versions - from 3.3.

Rendering in OpenGL

To start the rendering we need some data: vertices. Vertex is some point in 3d space. Common models consists of many vertices. Three vertices create triangle. So before we start the rendering process we need to have some modeled 3d objects. In code we represent vertices by theirs coordinates. Additionally we can set colors - we'll talk about it in later tutorials. You'll store vertex coordinates in arrays. It's hard to manually set all vertices, especially in complex 3d models. Later we'll load such models from files (that were created in some 3d modelling program).

So in the beginning of rendering process we have array of vertex coordinates. In next tutorial we'll start from 3 vertices to render triangle and in this tutorial we'll discuss theoretical part of how rendering happens.

Rendering pipeline

There are different steps from abstract 3d coordinate of the vertex in the array to visible pixel on the 2d window of the screen. All these steps together are called rendering pipeline.

The stages of rendering pipeline of OpenGL are: vertex shader, tesselation, geometry shader, vertex post-processing, primitive assembly, rasterization, fragment shader, per-sample operations.

We can affect on data on all shader stages. What is shader? Shader is just a program in GLSL - OpenGL Shading Language. We need to write shader programs by ourselves. GLSL is similar in syntax to C language, but has less capabilities.

From OpenGL 4.0 we can affect tesselation stage. OpenGL 4.3 has new shader - compute shader. We'll talk about this in following tutorials.

Our end goal is not just learn how to work with OpenGL but to learn all processes and all the math that's hidden in rendering pipeline. There will be series of tutorials in which we'll build our own software rendering pipeline.


In next tutorial we'll learn how to write shaders and will write some for the program that will render triangle on the screen.


April 18, 2020, 11:02 p.m.
1 Guest
Next tutorial? Where?
Sept. 26, 2020, 2:09 p.m.
2 Guest