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

didiksupriadi41

Didik Supriadi

Posted on February 3, 2020

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

💖 💪 🙅 🚩
didiksupriadi41
Didik Supriadi

Posted on February 3, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related