DEV Community

Didik Supriadi
Didik Supriadi

Posted on • Originally published at i3.ninja on

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 in below
  6. Run the demo project, and we’ll see this wonderful objects

Photo by Olia Gozha on Unsplash

Top comments (0)