OpenGL 4 Tutorials

Getting started with shaders and buffers

OpenGL works quite differently once we move away from glBegin. We’re going to create a window, load some shaders and set up our own matrices, then use VAOs and VBOs to draw something. There’s a bit more setup involved, but I’ll take you through it step by step.

OpenGL
OpenGL 3.2 core
GLSL 1.50
Code
C++ on Windows
Win32 and WGL
Before you start
Some C++
Basic graphics experience
Window & contextShaders & matricesGeometry & colour

Tutorials

Start with the window tutorial and follow along from there. Each tutorial adds to the code from the one before it.

  • 1. OpenGL 4 Window

    1. OpenGL 4 Window

    OpenGL 3.x and OpenGL 4.x came out all of a sudden, but not many people made the switch. Here you will learn how to create a window with an OpenGL 3.2 capable context, which can be ...

    Read tutorial →
  • 2. OpenGL 4 Shaders

    2. OpenGL 4 Shaders

    OpenGL 3.x and OpenGL 4.x rely on you to use shaders for all of your effects. This tutorial will show you how to incorporate the shaders from the GLSL section of the site into our new ...

    Read tutorial →
  • 3. OpenGL 4 Matrices

    3. OpenGL 4 Matrices

    OpenGL 3.x and OpenGL 4.x remove all matrix functions and force the developer to handle all matrices themselves. This is both a good and a bad thing. For beginners it takes a little more effort to ...

    Read tutorial →
  • 4. OpenGL 4 Vertex Array Objects (VAO)

    4. OpenGL 4 Vertex Array Objects (VAO)

    OpenGL 3.x and OpenGL 4.x deprecated virtually all client side rendering calls such as glEnable(GL_TRIANGLES) and glVertex3f, so how do we render things these days?. This tutorial will show you how to use Vertex Array Objects ...

    Read tutorial →
  • 5. OpenGL 4 Vertex Buffer Objects (VBOs) for Colour

    5. OpenGL 4 Vertex Buffer Objects (VBOs) for Colour

    Because OpenGL 3.x and OpenGL 4.x deprecated and then removed virtually all of the fixed function pipeline, how do we colour our polygons these days?. This tutorial will show you how to use two Vertex Buffer ...

    Read tutorial →

Before you start

I wrote these examples in C++ on Windows. You’ll need a compiler and a graphics card with drivers that support OpenGL 3.2. The first tutorial covers the Win32 and WGL code we need to get our window running.

If you want to spend more time on shaders, have a look at the GLSL tutorials. If this is your first time doing any graphics programming, the OpenGL 2 tutorials are an easier place to start. Or try WebGL if you want to draw in a browser.