How to Install Mesa (OpenGL) on Linux Mint
Part 1 of 3:
Preparing Your Linux Mint Operating System for OpenGL Development
- Open a terminal and enter the following commands to install the necessary libraries for OpenGL development:
- Enter sudo apt-get update
- Enter sudo apt-get install freeglut3
- Enter sudo apt-get install freeglut3-dev
- Enter sudo apt-get install binutils-gold
- Enter sudo apt-get install g++ cmake
- Enter sudo apt-get install libglew-dev
- Enter sudo apt-get install g++
- Enter sudo apt-get install mesa-common-dev
- Enter sudo apt-get install build-essential
- Enter sudo apt-get install libglew1.5-dev libglm-dev
- Get information about the OpenGL and GLX implementations running on a given X display. To do this, enter glxinfo .
Part 2 of 3:
Creating Your First OpenGL Program
- Open up a terminal. Make a directory, change into the directory and use your favorite text editor such as nano or gedit to create your OpenGL source code. Enter the following commands below.
- Enter mkdir Sample-OpenGL-Programs
- This will create a directory to hold your OpenGL programs.
- Enter cd Sample-OpenGL-Programs
- This will change you into your directory.
- Enter nano main.c OR gedit main.c
- Enter mkdir Sample-OpenGL-Programs
- Copy and paste OR type the code:
#include
#include void renderFunction() { glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); glBegin(GL_POLYGON); glVertex2f(-0.5, -0.5); glVertex2f(-0.5, 0.5); glVertex2f(0.5, 0.5); glVertex2f(0.5, -0.5); glEnd(); glFlush(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE); glutInitWindowSize(500,500); glutInitWindowPosition(100,100); glutCreateWindow("OpenGL - First window demo"); glutDisplayFunc(renderFunction); glutMainLoop(); return 0; } - Save the file and exit.
Part 3 of 3:
Compiling and Running Your OpenGL Application
- Enter the Sample-OpenGL-Programs directory. While there, run the following command:
- g++ main.c -lglut -lGL -lGLEW -lGLU -o OpenGLExample
- This command will compile and link your OpenGL libraries.
- g++ main.c -lglut -lGL -lGLEW -lGLU -o OpenGLExample
- Run the program. To do this, type the following:
- Enter ./OpenGLExample
- Wait for a result. If you did everything right, a window will open. It will show a white square on a black background. The window will be titled "OpenGL - First window demo".
4 ★ | 71 Vote
You should read it
- Instructions for installing Dev-C ++
- How to Set Up an OpenGL SDL GLEW Template Project in Visual Studio
- The sudo command is coming to Windows 11
- Linux Error SUDO allows you to run commands as root
- How to Set Up an OpenGL FreeGLUT GLEW Template Project in Visual Studio
- How to Set Up OpenGL‐GLFW‐GLAD on a Project with Visual Studio
- How to Make a Cube in OpenGL
- How to reset the password for sudo in Debian
May be interested
- How to Install Linux Mintthis wikihow teaches you how to replace your computer's operating system with linux mint. you can do this on both windows and mac computers. back up your computer. since you'll be replacing your computer's operating system with linux, it's...
- How to Keep in Touch with a Friendover time, friends and acquaintances can grow apart. although you may not be as close as you once were, it is still important to maintain a connection with people who you care about. there are so many easy ways to stay in contact with your...
- How to Create an Ubuntu Virtual Machine with VirtualBox (Mac)the following instructions will enable you to create an ubuntu virtual machine. they have been created specifically for a mac computer, but are essentially the same for windows. as you follow the instructions, you will see they have been...
- How to Run MediaWiki on Ubuntumediawiki is a free software wiki package written in php, and it is currently used by several projects of non-profit wikimedia foundation and by several other projects like that of wikihow . this guide may help you to run mediawiki on...
- How to Run Ubuntu from Windows as an Executablevirtual machine software allows you to take other operating systems such as ubuntu in your windows environment to try out the operating system. running ubuntu in a virtual machine will not give you the full potential of your hardware, but...
- How to Install Edubuntuedubuntu is an official flavour of ubuntu that they say is 'the free education orientated operating system for kids of all ages'. the aim of edubuntu is to get ubuntu into schools, homes and communities and to make is easy to install and...