OPENGL

In this page, you will find several examples for OpenGL programming. The examples are based on OWL and hence they show both the basics of OpenGL and how to combine it with OWL. I have selected the examples from various sources. Some of them are converted from MFC to OWL or taken from the Microsoft Documentation on OpenGL. Others are based on the OpenGL tutorials for the Windows Operating System from the GameDev Website. All examples are developed using OWL 6.44 and Microsoft Visual Studio targeted to x64, though you can retarget to x86 as well.


OpenGL-SDK, is a set of libraries that facilitate the OpenGL Programming. As an example, libbmpread32.lib and libbmpread64.lib are the libraries to load Bitmap files for textures in some of the examples. I have mainly used this library as a replacement for the outdated GLAUX library originally developed by Microsoft. The original code for the libbmpread library can be found on GitHub.


Cube-1 is a simple example that shows the basic steps for OpenGL programming using OWL. It also provides a framework for the other OpenGL examples that follow.


Cube-2 is ported to OWL from an original example in MFC. It presents the techniques for defining and using colors in OpenGL objects. It also demonstates how to animate objects by rotating them at certain intervals of time.


OpenGL Objects shows how to generate simple 3D objects and rotate them through arrow keys. It also demonstrates how to handle event messages from keyboard.


Tutor-1 is the first example in a series of tutorials that aim at demonstrating how to develop complex OpenGL objects. This tutorial combined with Cube-1 example provides the basis for other OpenGL tutorials.


Tutor-2 shows the steps to draw primitive shapes using OpenGL. This tutorial is built upon the previous tutorial and we are going to add new features to it in the next two tutorials.


Tutor-3 demonstrates how to add colors to basic shapes in OpenGL. Different colors are assigned to the vertices of the triangle and then the color varies gradually from one vertex to another.


Tutor-4 shows how we can rotate the tiangle and the square differently by changing their angles at certain intervals of time.


Tutor-5 presents the steps needed for generating colorful three-dimensional objects and rotating them in different directions.


Tutor-6 describes the details for texture mapping. A cube is generated using the OpenGL commands and then the image of a crate is mapped onto its faces. The libbmpread64.lib has been used to load the Bitmap file associated to the crate.


Tutor-7 is another example for texture mapping, which is based on an original example in GameDev Website. It also shows how to handle event messages for arrow keys. These messages are used to modify the angle of rotation for the cube. Hence, rendering the cube at certain intervals of time with new rotation angles makes it rotate in various direction. One can adjust the speed of rotation by using up, down, left and right arrow keys.

2025-06-01