Linux

How to Install the OpenGL Library on Ubuntu 20.04

OpenGL is a powerful graphics library that developers use to create stunning 2D and 3D graphics in their applications.

Ubuntu user looking to utilize the capabilities of OpenGL, we need to install the FreeGLUT3-dev package to access the OpenGL Utility Toolkit (GLUT). GLUT simplifies the creation of windows and handling user input, making it an essential tool for graphics programming. In this article, we will walk through the process of installing FreeGLUT3-dev on our Ubuntu system.

1. Login to the Ubuntu server and become a root user

sudo su

2. Update the server

Before installing any new software, it’s a good practice to update your package lists to ensure you’re getting the latest available updates from the repo.

Run the below command and Press ‘Y’ to start the Update && Upgrade process

apt update && apt upgrade

3. Install OpenGL Library

apt install freeglut3-dev

4. Verify Installation

dpkg -L freeglut3-dev

root@cloudscope:~# dpkg -L freeglut3-dev
/.
/usr
/usr/include
/usr/include/GL
/usr/include/GL/freeglut.h
/usr/include/GL/freeglut_ext.h
/usr/include/GL/freeglut_std.h
/usr/include/GL/glut.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libglut.a
/usr/share
/usr/share/doc
/usr/share/doc/freeglut3-dev
/usr/share/doc/freeglut3-dev/copyright
/usr/share/doc/freeglut3-dev/download.html
/usr/share/doc/freeglut3-dev/freeglut.html
/usr/share/doc/freeglut3-dev/freeglut_logo.png
/usr/share/doc/freeglut3-dev/freeglut_user_interface.html
/usr/share/doc/freeglut3-dev/index.html
/usr/share/doc/freeglut3-dev/ogl_sm.png
/usr/share/doc/freeglut3-dev/progress.html
/usr/share/doc/freeglut3-dev/structure.html
/usr/lib/x86_64-linux-gnu/libglut.so
/usr/share/doc/freeglut3-dev/changelog.Debian.gz

Uninstall OpenGL Library

apt remove freeglut3-dev

root@cloudscope:~# apt remove freeglut3-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
freeglut3 libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libegl-dev libegl-mesa0 libegl1 libgbm1 libgl-dev libgl1
libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgles-dev libgles1 libgles2 libglu1-mesa libglu1-mesa-dev libglvnd-dev
libglvnd0 libglx-dev libglx-mesa0 libglx0 libice-dev libice6 libllvm12 libopengl-dev libopengl0 libpciaccess0 libpthread-stubs0-dev
libsensors-config libsensors5 libsm-dev libsm6 libvulkan1 libwayland-client0 libwayland-server0 libx11-dev libx11-xcb1 libxau-dev
libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcb1-dev libxdmcp-dev
libxext-dev libxfixes3 libxi6 libxshmfence1 libxt-dev libxt6 libxxf86vm1 mesa-vulkan-drivers x11-common x11proto-core-dev x11proto-dev
x11proto-xext-dev xorg-sgml-doctools xtrans-dev
Use ‘apt autoremove’ to remove them.
The following packages will be REMOVED:
freeglut3-dev
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 761 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database … 91926 files and directories currently installed.)
Removing freeglut3-dev:amd64 (2.8.1-3) …

Conclusion

OpenGL libraries play a crucial role in various fields, from entertainment and game development to scientific research and professional graphics applications. In this guide we saw how we smoothly installed the OpenGL library on ubuntu.