I'm trying to follow this tutorial from 2018:
http://www.codebind.com/linux-tutorials/install-opengl-ubuntu-linux/
I'm under the impression that things must have changed with Ubuntu and configuring OpenGL since these instructions no longer work. In case the article disappears at some point I'll re-iterate all the steps here:
Ubuntu 20.04 install
Verify NVIDIA GPU is properly recognized by Ubuntu, install and configure CUDA (verified works with PyTorch)
Now on to the OpenGL specific stuff:
sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev
enter this program in gedit, save it as main.cpp
:
#include <GL/glut.h>
void displayMe(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex3f(0.5, 0.0, 0.5);
glVertex3f(0.5, 0.0, 0.0);
glVertex3f(0.0, 0.5, 0.0);
glVertex3f(0.0, 0.0, 0.5);
glEnd();
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(400, 300);
glutInitWindowPosition(100, 100);
glutCreateWindow("Hello world!");
glutDisplayFunc(displayMe);
glutMainLoop();
return 0;
}
Compile:
gcc main.cpp -o firstOpenGlApp -lglut -lGLU -lG
Here is the resulting output:
$ gcc main.cpp -o firstOpenGlApp -lglut -lGLU -lG
/usr/bin/ld: cannot find -lG
collect2: error: ld returned 1 exit status
Did something pertaining to configuring OpenGL change since this tutorial was written? What am I missing?
0 Answers