How to Install Mesa (OpenGL) on Linux Mint
Open a terminal and enter the following commands to install the necessary libraries for OpenGL development: Type/Copy/Paste: sudo apt-get update Type/Copy/Paste: sudo apt-get install freeglut3 Type/Copy/Paste: sudo apt-get install freeglut3-dev...
Step-by-Step Guide
-
Step 1: Open a terminal and enter the following commands to install the necessary libraries for OpenGL development: Type/Copy/Paste: sudo apt-get update Type/Copy/Paste: sudo apt-get install freeglut3 Type/Copy/Paste: sudo apt-get install freeglut3-dev Type/Copy/Paste: sudo apt-get install binutils-gold Type/Copy/Paste: sudo apt-get install g++ cmake Type/Copy/Paste: sudo apt-get install libglew-dev Type/Copy/Paste: sudo apt-get install g++ Type/Copy/Paste: sudo apt-get install mesa-common-dev Type/Copy/Paste: sudo apt-get install build-essential Type/Copy/Paste: sudo apt-get install libglew1.5-dev libglm-dev;
Type/Copy/Paste: glxinfo | grep OpenGL , Enter the following commands below.
Type/Copy/Paste: mkdir Sample-OpenGL-Programs this will create a directory to hold your OpenGL programs Type/Copy/Paste: cd Sample-OpenGL-Programs this will change you into your directory Type/Copy/Paste: "nano main.c" OR "gedit main.c" Copy and paste OR Type the code #include <GL/freeglut.h> #include <GL/gl.h> 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 , Type/Copy/Paste: g++ main.c
-lglut
-lGL
-lGLEW
-lGLU
-o OpenGLExample this command will compile and link your OpenGL libraries. ,, OpenGL Red Book OpenGL Blue Book -
Step 2: After your development libraries have been installed to get information about the OpenGL and GLX implementations running on a given X display.
-
Step 3: To create an OpenGL program
-
Step 4: open up a terminal
-
Step 5: make a directory
-
Step 6: change into the directory and use your favorite text editor such as nano or gedit to create your OpenGL source code.
-
Step 7: While in the Sample-OpenGL-Programs directory run the following command below.
-
Step 8: In order to run the program type the following below: Type/Copy/Paste: ./OpenGLExample
-
Step 9: For more information on OpenGL and other tutorials for you to try
-
Step 10: see the following online reference manuals.
Detailed Guide
Type/Copy/Paste: glxinfo | grep OpenGL , Enter the following commands below.
Type/Copy/Paste: mkdir Sample-OpenGL-Programs this will create a directory to hold your OpenGL programs Type/Copy/Paste: cd Sample-OpenGL-Programs this will change you into your directory Type/Copy/Paste: "nano main.c" OR "gedit main.c" Copy and paste OR Type the code #include <GL/freeglut.h> #include <GL/gl.h> 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 , Type/Copy/Paste: g++ main.c
-lglut
-lGL
-lGLEW
-lGLU
-o OpenGLExample this command will compile and link your OpenGL libraries. ,, OpenGL Red Book OpenGL Blue Book
About the Author
Alexis Rivera
With a background in lifestyle and practical guides, Alexis Rivera brings 1 years of hands-on experience to every article. Alexis believes in making complex topics accessible to everyone.
Rate This Guide
How helpful was this guide? Click to rate: