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...

10 Steps 1 min read Medium

Step-by-Step Guide

  1. 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
  2. Step 2: After your development libraries have been installed to get information about the OpenGL and GLX implementations running on a given X display.

  3. Step 3: To create an OpenGL program

  4. Step 4: open up a terminal

  5. Step 5: make a directory

  6. Step 6: change into the directory and use your favorite text editor such as nano or gedit to create your OpenGL source code.

  7. Step 7: While in the Sample-OpenGL-Programs directory run the following command below.

  8. Step 8: In order to run the program type the following below: Type/Copy/Paste: ./OpenGLExample

  9. Step 9: For more information on OpenGL and other tutorials for you to try

  10. 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

A

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.

96 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: