Tuesday, November 3, 2015

OpenGL : how to install in Ubuntu 14.04


Check if OpenGL is installed or not:
$glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 660/PCIe/SSE2
OpenGL core profile version string: 4.3.0 NVIDIA 352.30
OpenGL core profile shading language version string: 4.30 NVIDIA via Cg compiler
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.5.0 NVIDIA 352.30
OpenGL shading language version string: 4.50 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:


If you get error:

Install mesa-utils and run the command again.

$sudo apt-get install mesa-utils
$glxinfo | grep OpenGL


Refer:

http://www.codeproject.com/Articles/182109/Setting-up-an-OpenGL-development-environment-in-Ub

When you run the sample code firstWindow.cpp, you may get an error:

$ g++ firstWindow.cpp -lglut
/usr/bin/ld: /tmp/ccT2pQWr.o: undefined reference to symbol 'glClear'
//usr/lib/x86_64-linux-gnu/libGL.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

solution: add -lGL

$ g++ ./firstWindow.cpp -lGL  -lglut 
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status

I got error. 
Solution: Locate libGL.so and create soft link  /usr/lib/libGL.so

$ locate libGL.so
/usr/lib/libGL.so.1
/usr/lib/x86_64-linux-gnu/libGL.so
/usr/lib/x86_64-linux-gnu/libGL.so.1
/usr/lib/x86_64-linux-gnu/libGL.so.352.30
/usr/lib/x86_64-linux-gnu/mesa/libGL.so
/usr/local/MATLAB/R2015a/sys/opengl/lib/glnxa64/libGL.so.1
/usr/local/MATLAB/R2015a/sys/opengl/lib/glnxa64/libGL.so.1.5.070200



$ sudo ln -s /usr/lib/libGL.so.1 /usr/lib/libGL.so

No comments:

Post a Comment