Set up OpenGL Utility Toolkit (GLUT) and Codeblocks on Linux

Before we continue, let’s discuss something about GLUT and Codeblocks.

Here we use FreeGLUT instead of the original GLUT written by Mark Kilgard. FreeGLUT is an open-source alternative to the OpenGL Utility Toolkit (GLUT) library with a free software license. FreeGLUT allows us to create and manage windows containing OpenGL contexts on a wide range of platforms and also read the mouse, keyboard, and joystick functions.

Codeblocks is a free C++ IDE that is extensible and configurable. Codeblocks can be extended with plug-in DLLs and even you can compile your own plug-ins.

Before we begin to set up, let’s prepare some packages that need to be installed beforehand.

Install Codeblocks

  • On Fedora
sudo dnf install codeblocks
  • On Ubuntu
sudo apt install codeblocks

Install FreeGLUT

  • On Fedora
sudo dnf install freeglut-devel
  • On Ubuntu
sudo apt install freeglut3-dev

Set up GLUT in Codeblocks

  1. Open Codeblocks
  2. Go to Settings -> Global variables…
  3. Under Current variable, click New and create glut variable
  4. Fill in each field as shown below, and click Close when finish
    • On Ubuntu
    • On Fedora

Let’s try to create a new project

  1. Open the project wizard
  2. Create a “HelloWorld” Project
  3. Use glut global variable
  4. Leave the default compiler configuration as it is and then click Finish
  5. A demo project will be created as shown below
  6. Run the demo project, and we’ll see these wonderful objects

Photo by Olia Gozha on Unsplash

Leave a Reply

The opinions expressed on this website are those of the author, @didiksupriadi41. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The i3 Ninja Logo is a trademark of i3 Ninja.

%d bloggers like this: