The Basics


Before we can start with the actual OpenGL coding, we need to set up a basic template, or framework, for our applications. This template code will be used for all the other tutorials. It may not be very exciting, but once it is done we have a good base for OpenGL development. You will also see that with GLFW this framework code is both compact and readable.

We continue with some simple OpenGL rendering and coloring to get a feeling of how the OpenGL API works.

This section is designed to give a hands on experience with OpenGL and GLFW. The focus is to get an OpenGL application running rather than learning the in depth details of OpenGL. Lessons in other sections will explain more details of OpenGL.


Lesson 0: Compiling the programs

Before we get started with the good stuff, here is a short description of how to compilie the programs that are included in the following lessons.

Lesson 0

lesson00.zip (HTML)


Lesson 1: Template code

In this lesson, you will learn how to set up a window, and to respond to some basic keyboard input. This code is the basics for all the following lessons, so read it well. All that it accomplishes is to show a black window, so do not expect anything graphically exciting from this lesson.

Lesson 1

lesson01.zip (HTML & program source)


Lesson 2: A triangle

This is just a small addition to the first lesson. A static triangle is drawn in the window.

Lesson 2

lesson02.zip (HTML & program source)


Lesson 3: Color

Moving along in small steps, we add color to the triangle from lesson 2.

Lesson 3

lesson03.zip (HTML & program source)


Lesson 4: Animation

With a simple addition to the previous lesson, we make the triangle rotate.

Lesson 4

lesson04.zip (HTML & program source)