How to Install Mesa (OpenGL) on Linux Mint

Part 1 of 3:

Preparing Your Linux Mint Operating System for OpenGL Development

  1. How to Install Mesa (OpenGL) on Linux Mint Picture 1
    Open a terminal and enter the following commands to install the necessary libraries for OpenGL development:
    1. Enter sudo apt-get update
    2. Enter sudo apt-get install freeglut3
    3. Enter sudo apt-get install freeglut3-dev
    4. Enter sudo apt-get install binutils-gold
    5. Enter sudo apt-get install g++ cmake
    6. Enter sudo apt-get install libglew-dev
    7. Enter sudo apt-get install g++
    8. Enter sudo apt-get install mesa-common-dev
    9. Enter sudo apt-get install build-essential
    10. Enter sudo apt-get install libglew1.5-dev libglm-dev
  2. How to Install Mesa (OpenGL) on Linux Mint Picture 2
    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

  1. How to Install Mesa (OpenGL) on Linux Mint Picture 3
    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.
    1. Enter mkdir Sample-OpenGL-Programs
      1. This will create a directory to hold your OpenGL programs.
    2. Enter cd Sample-OpenGL-Programs
      1. This will change you into your directory.
    3. Enter nano main.c OR gedit main.c
  2. 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; } 
  3. How to Install Mesa (OpenGL) on Linux Mint Picture 4
    Save the file and exit.
Part 3 of 3:

Compiling and Running Your OpenGL Application

  1. How to Install Mesa (OpenGL) on Linux Mint Picture 5
    Enter the Sample-OpenGL-Programs directory. While there, run the following command:
    1. g++ main.c -lglut -lGL -lGLEW -lGLU -o OpenGLExample
      1. This command will compile and link your OpenGL libraries.
  2. How to Install Mesa (OpenGL) on Linux Mint Picture 6
    Run the program. To do this, type the following:
    1. Enter ./OpenGLExample
  3. How to Install Mesa (OpenGL) on Linux Mint Picture 7
    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

May be interested

  • Distinguish Ubuntu and Linux MintDistinguish Ubuntu and Linux Mint
    linux is an open-source operating system and anyone can edit and customize to their liking, ubuntu and mint are the two operating systems born from that.
  • How to change desktop theme on Linux MintHow to change desktop theme on Linux Mint
    linux mint is a great linux distribution for anyone getting started with linux. it comes in 3 different versions: cinnamon, mate and xfce, each catering to a different audience.
  • Linux Mint Debian Edition 4: Noteworthy changes and additionsLinux Mint Debian Edition 4: Noteworthy changes and additions
    linux mint debian edition (lmde) 4 has been officially launched with many notable changes and updates.
  • Instructions for installing Dev-C ++Instructions for installing Dev-C ++
    this article explains how to compile programs written in ansi c with opengl and glut using the dev-c ++ compiler.
  • Why should you leave Ubuntu and choose Linux Mint as your main operating system?Why should you leave Ubuntu and choose Linux Mint as your main operating system?
    after years of using ubuntu and exploring different linux distributions, many people have finally switched to linux mint as their primary operating system.
  • How to Install Linux MintHow to Install Linux Mint
    this 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...
  • Instructions for installing basic Arch LinuxInstructions for installing basic Arch Linux
    unlike ubuntu or linux mint, arch linux is a distributed linux distribution in a continuous format (rolling release). read the following article to know how to install this distro.
  • How to Install JDK in LinuxHow to Install JDK in Linux
    this wikihow teaches you how to install the latest version of jdk (java 12) on debian, ubuntu, and linux mint using the linux rising ppa repository. press to open a new terminal window. if you're already at the command prompt, just skip to...
  • Watch YouTube videos on Linux Mint 11 with MinitubeWatch YouTube videos on Linux Mint 11 with Minitube
    in the following article, we will guide and introduce you to a support tool for watching youtube videos on the desktop platform, specifically the linux mint 11 operating system called minitube - essentially 1 chapter with a graphical interface, where the user can enter the search keyword, the system will fully display the return list with information
  • Skype is available for Linux users, download and experienceSkype is available for Linux users, download and experience
    skype, the popular voip application, is now available for linux distributions like ubuntu and linux mint for users to experience. this is good news for the community of open source operating systems for computers.