PDA

View Full Version : New to OpenGL in Linux



Old GLman
08-05-2002, 09:21 AM
Hello, last week I dumped windows and put Linux on. I'll never go back! Now Im not new to OpenGL, but I am to Linux. Now I'm assuming RedHat 7.3 already comes with OpenGL libraries. Where exactly would these be located? Or what implementation do I download? Id like to get started with glut. Also whats a good compiler for programming OpenGL in. My friend says he uses vim for everything, but how good is that for OpenGL. Thanks for your help.

Old GLman

Error23
08-05-2002, 11:03 AM
find / -name file.h to search, whatever header file you are lookin' for. search as root if you dont have read (+r) permissions as your regular user. I have my headers in, /usr/include/ and /usr/X11R6/include/ .... //Tyler

[This message has been edited by Error23 (edited 08-05-2002).]

Old GLman
08-05-2002, 11:14 AM
Thanks for your reply. I found the headers and libraries. Any comments on a compiler? Or just personnal preference?

Old GLman

Error23
08-05-2002, 11:16 AM
i use gcc-2.95.3 thats my favorite. http://www.opengl.org/discussion_boards/ubb/wink.gif

nutball
08-05-2002, 11:58 PM
Firstly, if you have an nVidia-based card you're better off downloading their drivers, 'cos you get hardware very-acceleration. I think you'll find the drivers which ship with RedHat will be Mesa (software rendering).

Secondly, Intels' compilers are free for Linux for non-commercial use, and are half decent (faster than GCC under some circumstances). Unfortunately they don't interoperate with GCC if you're compiling C++ code (groan). But they're free, and worth a try!

Old GLman
08-06-2002, 05:45 AM
Thanks for your help guys.Yeah the first thing I did when I got RedHat up was install the nvidia drivers! Was a pain, cause I knew nothing about Linux then, but thankfully everything has a readme.

Old GLman

rixed
08-06-2002, 06:37 AM
If nvidia drivers (that is, kernel module and GL library) are correctly installed, you can use gcc to play with it.

You can open an openGL windows in X directly with GLX, or use GLUT or SDL to ease the process.

Anyway, VI is great and VIM is the greatest ! Real programmers do not use IDE, they need VI*P0wA !! :-)

Old GLman
08-06-2002, 02:18 PM
Ok, Im having some trouble getting started here. Where can I find the Mesa implementation of Glut? Specifically glut.h. I downloaded the latest Glut source, but even following the instructions, getting that setup is beyond me at the moment.

Also what exactly is GLX? What exactly is DRI? What exactly should I be using!? Im still a newbie when it comes to compiling stuff in linux. Thanks for help.

Old GLman

OldMan
08-07-2002, 07:48 AM
GLX is the OpenGl implementation.. for X.

DRI is an interface for fast access to hardware without all the overhead of linux kernel. With you have a NVIDIA card you dont need DRI since NVIDIA drivers are independent of it.

If you have an ATI board, go to dri.sourceforge.net

you dont need to know where glut is.. just use -lglut at compiler options and include <GL/glut.h>... the standard includes directory is default in linux and GCC will look there.

To compile premade software just execute the makefiles that come with them.

to compile your stuff use gcc -lLIBRARY_U_DESIRE_TO_LINK -o OUTPUT_NAME SOURCE.CC

for more information use man gcc.

And gcc is by far the best compiler for linux... especially 3.0 Very fast... very good at templates solving.

08-07-2002, 03:09 PM
It depends on your hardware what implementation you should use. My advice is to not install anything new before you know that it is the right step.

It is probably a good idea to spend a day or two getting comfortable with the system. Here is some sites I like http://heather.cs.ucdavis.edu/~matloff/unix.html http://users.actcom.co.il/~choo/lupg/tutorials/

grimreaper08
08-08-2002, 02:29 AM
Also experienced similar problem, currently using Mandrake 8.0.

I'm new to openGL, also considered a newbie to Linux.

Installed Mesa-4.0.3 and then the Nvidia GLX drivers and kernel.

Tried compiling lesson1.c from NeHe, but it complained about cannot finding "glut.h" and "glu.h".

So I browse /usr/includes/GL/ and they are really not there.

Can someone plz enlight....
Thanx

rixed
08-08-2002, 06:22 AM
there was a tarball named gluandglut.tgz which contains GLU and GLUT sources, but its not easy to find it anymore. Thats what I use and it works without trouble.
I still have the tarball on my disk, if someone want it, I can put it somewhere.

amendol
08-08-2002, 10:02 PM
please see my post here.
http://www.opengl.org/discussion_boards/ubb/Forum4/HTML/000732.html

It describes my workarounds for getting a compile environment to work.

Jamie

OldMan
08-09-2002, 11:30 AM
If you will use the nvidia OpenGL implementation, do not install MESA, as it can confuse the installer. In fact MESA will be rmoved when installing NVIDIA drivers.

Also avoid mandrake as it usually doesn't come with all libraries.

[This message has been edited by OldMan (edited 08-09-2002).]

Codemasta
08-12-2002, 03:58 AM
Hi!

You should use SDL .. its very easy ...
download this: http://www.libsdl.org/cvs/SDL-1.2.tar.gz
then open a console and type:
# cd /dir/where/you/downloaded
# tar xfz SDL-1.2.tar.gz
# cd SDL- <TAB>
# ./configure
# make
# su -c 'make install'

so, now its installed, you have to compile you programs with:
# gcc `sdl-config --libs` `sdl-config --cflags` SOURCE.CPP -o EXECUTABLE_NAME

you have to include:
<SDL/SDL.h>
<SDL/SDL_opengl.h>
<GL/gl.h>
<GL/glu.h>
<iostream>
<fstream>

hope i helped http://www.opengl.org/discussion_boards/ubb/smile.gif

SDL-Documentation-Project: http://sdldoc.csn.ul.ie/

SDL-Homepage: http://www.libsdl.org/

mfg codi
edit:
a few links for tutorials to opengl&sdl http://sdldoc.csn.ul.ie/guidevideoopengl.php http://www.gametutorials.com/ http://www.resourcecode.de/

[This message has been edited by Codemasta (edited 08-12-2002).]

grenadier
08-13-2002, 07:38 AM
Hey,

I'm an experienced OpenGL programmer, but I'm relatively new to Linux. Anyways
I'm now using Debian and I'm unsure as to where I should get my drivers from. Debian's dselect option does not bring up any OpenGL packages, and nVidia does not have any .rpm files for Debian.

any ideas?

amendol
08-13-2002, 07:43 PM
They do have tar files though. Just gunzip, tar -xvf them and read the readme's. I believe that you just type make in the new directories. You'll need the kernel file, and the GLX file.

Jamie

marcus256
08-13-2002, 10:55 PM
For people new to OpenGL and/or GL under Linux, perhaps this link can help: http://hem.passagen.se/opengl/getstarted/

Of course, the GLFW toolkit can be a good alternative to GLUT. Check it out here: http://hem.passagen.se/opengl/glfw/

The GLFW distribution includes example programs and Makefiles for Linux (showing how to link etc).

martin_marinov
08-14-2002, 02:33 AM
Hi,
I use RedHat 7.1 Personal. Never had any problems with installing Nvidia drivers, compiling under non-Nvidia hw with Mesa/DRI - (Ati, Matrox, etc). Everything related to development/OpenGL(and not only this) worked from the first time.
I guess now redhat is considered something as M$ amoung the linux distros - but still it is one of the best http://www.opengl.org/discussion_boards/ubb/smile.gif
Worth a try...

Regards
Martin

Old GLman
08-15-2002, 05:17 PM
Hello again.

I wrote a little glut test program. I compile like so:

gcc -L/usr/X11R6/lib -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm -o gluttest gtest.c

My question is why do I have to specify the libraries directory? Isnt it standard like /usr/include/ ?

PS No it hasnt taken me this long to write a simple test program since my original post http://www.opengl.org/discussion_boards/ubb/smile.gif I've been learning linux in general..

Thanks for your help.

amendol
08-15-2002, 08:47 PM
Originally posted by martin_marinov:
Hi,
I use RedHat 7.1 Personal. Never had any problems with installing Nvidia drivers, compiling under non-Nvidia hw with Mesa/DRI - (Ati, Matrox, etc). Everything related to development/OpenGL(and not only this) worked from the first time.
I guess now redhat is considered something as M$ amoung the linux distros - but still it is one of the best http://www.opengl.org/discussion_boards/ubb/smile.gif
Worth a try...

Regards
Martin

OT warning:

OK, I started with slackware (long time ago). A little while after that everyone seemed to be using Redhat, so I switched too. Up to Redhat 6.2 it seemed very very nice. 7.0/7.1 was so so so broken (lot's of crashes, and problems) that I completely gaveup on it. I've been using Mandrake, and it's been pretty good, but constantly getting more unstable. I've never seen Linux crash so much. I'm getting close to switching back to Redhat. (One of the main reasons that I use Linux in the first place is beacuse of it's UNIX roots giving it a solid foundation). Mandrake's crashing is making me want something else...

Is it safe to go back to Redhat now?

martin_marinov
08-15-2002, 09:05 PM
Originally posted by Old GLman:
Hello again.

I wrote a little glut test program. I compile like so:

gcc -L/usr/X11R6/lib -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm -o gluttest gtest.c

My question is why do I have to specify the libraries directory? Isnt it standard like /usr/include/ ?

PS No it hasnt taken me this long to write a simple test program since my original post http://www.opengl.org/discussion_boards/ubb/smile.gif I've been learning linux in general..

Thanks for your help.

Hi,
I compile X/OpenGL programs in the same way (well using makefiles). I guess /usr/X11R6/lib should be included, because X is not something which is considered part of the standard linux libraries - you can use another X servers, even not use X at all...
Still I'm not a linux expert, so the reason may be another...

OT
amendol, I've used Suse once before 18 months, since then I use only RH 7.1 - at home, at the university, at work... - seem like everyone here is using only this. I cannot comment on any problems with it, I did not had any...

Regards
Martin

OldMan
08-16-2002, 02:15 AM
Red Hat 7.3 is quite better... but got very..very fat.... is not made for slower machines....

If you dont like to use so much libraries.. you can use SDL... so your compiling would be
gcc -lGL -lSDL -lpthread namecode.cc

thelamberto
08-16-2002, 06:46 AM
Just to jump on the linux newbie band wagon....I'm using Redhat on a University network.

I'm trying to make the Linux/GLX example from NeHe's lesson01. I get an error like so:
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libGL.so: undefined reference to 'pow'

In fact this happens with all the GLX ports on NeHe's site, with me anyway.

From my limited knowledge of Linux I'd say I'm using gcc 2.96 on RedHat 7.3 (I think?!?)

Should I get a new version of libGL? Don't know if anyone can throw any light on this.....

[This message has been edited by thelamberto (edited 08-16-2002).]

amendol
08-16-2002, 11:28 AM
the pow function comes from the math library. You need to ad -lm to you compile to link in the math library.

Jamie