Jump to content
  • Advertisement

Archived

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

cody

opengl & linux

This topic is 6116 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

yesterday i installed suse linux 7.3. i wanted to make a small opengl program with gcc. but it doesnt find the gl headers and the lib file. so what do i need to compile a opengl program? a have already installed the nvidia display drivers for my geforce3 and it works. where do i get the library files, headers and dlls for gl? i noticed that linux uses other file extensions than windows. .dll=.so (i think) .lib=? what about kdevelop? is it good? it looks like vc... cody

Share this post


Link to post
Share on other sites
Advertisement
Well I''m not even as far along as you are. I''m still
trying to get Linux to play nice with all my hardware.
But hell that was an up hill battle in windows.
anyway, if I recall you will need to download the openGL
header files. They are not included directly with the OS
generaly. They do get around alot so you may pick up the source
code somewhere or I think they are avalible on whatever OpenGL
site you might find. Most prog. that use OpenGL probably are
already precompiled so they have little need to supply u with
the source code. I think thats what I read somewhere.

Share this post


Link to post
Share on other sites
Most Linux distros use Mesa, the Open Source implementation of the OpenGL spec (I believe it''s 1.2-compliant). Your GL header files should have been installed if you installed development packages; check your /usr/include directory. The appropriate libs should also be in /usr/lib.

Linux libraries are named lib*, where the * represents the package name. So the Standard C++ Library is libsdtc++, and the Mesa (OpenGL) libraries are libGL, libGLU (GLUT), etc. Library files come in two flavors: shared object and static libraries. Shared objecys (think: Windows DLLs) have the .so extensions, which would mean libGL.so for GL shared objects; and .a for static libs (libGL.a).

Have fun, kids!

Share this post


Link to post
Share on other sites
Actually, .lib != .a

Windows uses .libs for both static linking and dynamic linking. In the latter case, the .lib just holds information about which functions are in the .dll.

On Linux, you use .a for static linking, and the .so holds both the actual library code and the linking information used w/ dynamic linking.

cu,
Prefect

One line of sourcecode says more than a thousand words.

Share this post


Link to post
Share on other sites
OK, but perhaps can you say .lib=.a and .so=.dll but you do not need any import libraries in linux.

Share this post


Link to post
Share on other sites
Libraries under Linux have extensions with .so
or .so.. Example: libGL.so.1.2

If you have /usr/Somewhere/lib/libGL.so.1.2
then somewhere on yer linker line you need
-lGL and -L/usr/Somewhere/lib

Note that the lib prefix of the file name of
libGL.so.1.2 is omitted and also the extension
is omitted as well.

Share this post


Link to post
Share on other sites
Usually you will find the openGL-headers in /usr/include/GL.
So just include GL/GL.h (or possibly GL/gl.h, I can''t remember right now).
Note that linux is case-sensitive, so be sure that the directory is GL and not gl.

-Neophyte

Share this post


Link to post
Share on other sites
Did you include the OGL library in the command line for compiling:
gcc mysource.c -o myexecutable -lGL

I tried in vain to compile some oGL programs, and it worked after I included the GL library in the gcc command with the -l option.

I hope this helps

Share this post


Link to post
Share on other sites
thanks for your help, but i didnt get it to work:-(

my problem is:
i searched for gl.h, libGL etc. and found some files... all in different directories and cant imagine how gcc should find them... so where must these files be?

-lGL doesnt work, gcc sais there are undefined references.
i used this header:
/usr/share/doc/packages/nv_glx/usr/include/GL/gl.h
(how should somebody find that??)
-there is a libGL.so.1.0.1541.nv_glx in /usr/lib, however i dont know how to use it, gcc also doesnt work when i copy the libGL to my working directory.

-in /usr/include are no gl headers

i would like to use the nvidia headers and libs like obelix said.

im totally confused... windows is easier...

cody

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!