Archived

This topic is now archived and is closed to further replies.

rohde

OpenGL on Linux

Recommended Posts

rohde    432
Forgive me if this is stupid, but I''m new at Linux. I have Mandrake 9.2 installed. Do OpenGL come installed by default? When I try to compile an OpenGL program the compiler can''t find the OGL headers. I know that this might just be a case of setting the proper include directorues etc., but I have absolutely no idea where these headers would be located on a Linux box. Therefore I ask (before I start searching for the headers), do they come with the distro by default or do I have to download them?
Human beings, by changing the inner attitudes of their minds, can change the outer aspects of their lives.
William James (1842 - 1910)

Share this post


Link to post
Share on other sites
Ilici    862
I''m quite new to Linux too and I aslo have MDK 9.2. I''ve installed Anjuta as my IDE and it''s great. To use OpenGL, open rpmdrake (configuration - packages - install software) and search for GL and GLUT. install all of those MESA libs you find and also, if you use Anjuta, automake and autoconf (or find them on the web).

Now to use it: in Anjuta, open up the settings - compiler and linker and add /usr/X11R6/lib to the lib paths and /usr/X11R6/include to the inlude paths. now add "GL", "GLU" and "glut" to the libraries.

and in the program do this: #include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

(after installing the GLUT lib, make sure you have libglut.so in your /usr/X11R6/lib dir, if you have libglut.so.3 or smth like that just make a copy and name it libglut.so)

Share this post


Link to post
Share on other sites
Null and Void    1088
quote:
Original post by Ilici
(after installing the GLUT lib, make sure you have libglut.so in your /usr/X11R6/lib dir, if you have libglut.so.3 or smth like that just make a copy and name it libglut.so)

You shouldn''t do that (make a copy of the library, that is). When something links to GLUT with -lglut it will look for the file libglut.so. When the linker finds libglut.so, the idea is that the linker will find out what major-version of GLUT libglut.so represents by what it''s pointing at. So, libglut.so should be a symlink to libglut.so.3 or, more commonly, a symlink to whatever libglut.so.3 points at.

Not only does that cause the linker to pick the correct major-version it will allow you to replace libglut.so.3 (or whatever) with a newer version and automatically have libglut.so point at it.

However, doing this manually isn''t the best way to go about it. One is meant to execute ldconfig (as root) after every installation (among other things) of libraries to one of the directories managed by /etc/ld.so.conf. Doing that should generate the "base" symlinks to all of the libraries if they don''t exist as well as cache the names of installed libraries.

Share this post


Link to post
Share on other sites
Doc    586
quote:
Original post by Null and Void
However, doing this manually isn''t the best way to go about it. One is meant to execute ldconfig (as root) after every installation (among other things) of libraries to one of the directories managed by /etc/ld.so.conf. Doing that should generate the "base" symlinks to all of the libraries if they don''t exist as well as cache the names of installed libraries.



Of course this sort of thing ought to happen by the package manager itself when installing library packages, so it''s likely you won''t need to worry about it.

Image loads when I''m online since I''m too lazy to find a permanent host.The following statement is true. The previous statement is false.
Shameless promotion:
FreePop: The GPL Populous II clone.

Share this post


Link to post
Share on other sites