0% found this document useful (0 votes)
11 views2 pages

Opengl Installation Steps

This document provides a step-by-step guide on how to install OpenGL on a Linux Mint operating system, including necessary library installations and verification of OpenGL functionality. It also outlines the creation of a simple OpenGL program, detailing the commands to set up a directory and write source code. Finally, it explains how to compile and run the OpenGL application using specific commands in the terminal.

Uploaded by

shrigujar25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Opengl Installation Steps

This document provides a step-by-step guide on how to install OpenGL on a Linux Mint operating system, including necessary library installations and verification of OpenGL functionality. It also outlines the creation of a simple OpenGL program, detailing the commands to set up a directory and write source code. Finally, it explains how to compile and run the OpenGL application using specific commands in the terminal.

Uploaded by

shrigujar25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

How to Install OpenGL on Linux

Part-1 Prepare your Linux Mint operating system for OpenGL Development
1 Open a terminal and enter the following commands to install the necessary
libraries for OpenGL development:
Type/Copy/Paste following commands:
$ sudo apt-get update
$ sudo apt-get install freeglut3
$ sudo apt-get install freeglut3-dev
$ sudo apt-get install binutils-gold
$ sudo apt-get install g++ cmake
$ sudo apt-get install libglew-dev
$ sudo apt-get install g++
$ sudo apt-get install mesa-common-dev
$ sudo apt-get install build-essential
$ sudo apt-get install libglew1.5-dev libglm-dev

2 Get information about the OpenGL and GLX implementations running or not?

$ glxinfo | grep -i opengl

Your will get follwoing information : ( It Means OpenGL Installed )


OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 8800 GT/PCIe/SSE2
OpenGL version string: 2.1.2 NVIDIA 310.44
OpenGL shading language version string: 1.20 NVIDIA via Cg compiler
OpenGL extensions:

Part-2 Create your first OpenGL program

To create an OpenGL program, open up a terminal, make a directory, change


into the directory and use text editor such as gedit to create your OpenGL
source code.
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:
$ gedit main.c
Copy and paste OR Type the code :

1. #include <GL/freeglut.h>
2. #include <GL/gl.h>
3.
4. void renderFunction()
5. {
6. glClearColor(0.0, 0.0, 0.0, 0.0);
7. glClear(GL_COLOR_BUFFER_BIT);
8. glColor3f(1.0, 1.0, 1.0);
9. glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
10. glBegin(GL_POLYGON);
11. glVertex2f(-0.5, -0.5);
12. glVertex2f(-0.5, 0.5);

Page 1 of 2
13. glVertex2f(0.5, 0.5);
14. glVertex2f(0.5, -0.5);
15. glEnd();
16. glFlush();
17. }
18. int main(int argc, char** argv)
19. {
20. glutInit(&argc, argv);
21. glutInitDisplayMode(GLUT_SINGLE);
22. glutInitWindowSize(500,500);
23. glutInitWindowPosition(100,100);
24. glutCreateWindow("OpenGL - First window demo");
25. glutDisplayFunc(renderFunction);
26. glutMainLoop();
27. return 0;
28. }

 Save the file and exit

Part-3 Compile and Run your OpenGL application

1 This command will compile and link your OpenGL libraries.


$ g++ main.c -lglut -lGL -lGLEW -lGLU -o OpenGLExample

2 In order to run the program type the following below:


$ ./OpenGLExample

Page 2 of 2

You might also like