Writing a basic game with C++ and OpenGL libs – part 1 .

This is a first part tutorial about linux game using C++ and OpenGL libs.

Writing a C++ game can be difficult.

You will need to focus on program structure and then to know how to create the necessary classes.

Let’s see the files I used:

The main.cpp file is the main program.

This file will make the window program and will deal with the user.

Also this file use OpenGL libs.

Let’s see the source code:

The next two files : display.cpp and display.hpp is used to display the game objects.

I use just one class : Display.

Let’s see the header file display.hpp

… and display.cpp.

You can see the OpenGL source code to make a rectangle.

The next files game.cpp and game.hpp is used to make all game engine working.

The header file game.hpp is:

… and also game.cpp.

Let’s make the Makefile.

This can done well if you know how working g++ compiler.

Use the command to make the binary file:

The resul is this:

simplegame tutorial c++

Irrlicht – 3D Engine – Part 1

What is Irrlicht Engine ?

The Irrlicht Engine is an open source 3D engine.
This engine is written and usable in C++ and also available for .NET.
The engine is completely cross-platform using D3D and OpenGL.

How works ?

Download the irrlicht from http://irrlicht.sourceforge.net.
I will show how this working on Linux. I use Fedora 12.
In this tutorial I will show how to used Irrlicht 1.6 .
The new version – irrlicht 1.7 is used in same manner.
First i install libs of OpenGL and g++.
See below , i used yum command in super user mode:

Now in same manner,you will install g++:

First, i downloaded both arhives of irrlicht–1.6.1 and irrlicht–1.7.1, see this command:

Now, go and write on console this commands :

You will see something like this:

This will take a time…

As you see , this will build all examples.
Finally you see some errors , don’t worry.

In this moment you can run all examples (see /irrlicht-1.6.1/bin/Linux/).
Let’s try one:


If you will try to run all examples and you have a old graphic card not all will run properly.

Some examples run only on console because you need to select driver.
You will see this message :

The tools from Irrlicht

The Irrlicht has some tools to helps users.
The directories from tools folder is :

Only GUIEditor, newFontTool and MeshConverter works on Linux.

See now how compile the GUIEditor

When you compiling GUIEditor you see some errors:

But, GUIEditor running well.


See now how compile the newFontTool.

The output file is Fontool on /bin/Linux/


See now how compile the MeshConverter.

The Irrlicht 1.7.1 will be installed in the same way.
I tried that.