Geting opengl

Where do i find gl.h etc. to install in linux?

Depends on the distribution.There’s usually a package with everything you need.Look for something along the lines of xlibsmesa-dev or mesa-dev or libgl-dev etc,etc.Actually because the HW accel. gl implementation is part of X the first option or something similar should be preferred.

It also depends on your video card.

If it’s an nVidia, when you download the drivers from nv, it comes with it’s own OpenGL implementation (including gl.h).

If it’s one of the cards listed on the status page of the dri site, you’ll hopefully be able to get running with mesa/dri hardware accel. (I’m having trouble with this at the moment with my matrox g400 16MB oem).

If you go the dri route, you can’t just download a new mesa to upgrade. I think the dri and the mesa “go together” somehow (maybe someone could explain?).

If all else fails, you could download mesa and have it do software-rendering for you.

jmg, for an explanation check out the faq at dri.sourceforge.net .The question “How does Mesa fit into the DRI?” explains it.BTW wht sort of trouble do you have mith your G400 16MB? My G400MAX 32MB works pretty well.

Zen, thanks for asking.

I’ve tried installing first Debian Woody then Mandrake 8.2. Both had problems.

I spent the most time trying to get it working with Mandrake 8.2. I’ve got an NEC LCD 1525x flat panel but am feeding it the analog signal from the 15-pin connector on the g400.

I’ve found that if I run xf86config and ask for 1024x768 (the flat panel’s native resolution), the mouse (ps/2 on /dev/psaux) won’t work properly. It just flys all over the place. It’s a plain vanilla ps/2 logitech wheel-mouse.

If I set the resolution to 800x600, the mouse works again.

During my experiments, there was even a case where X would start but KDE would not (it would bail right at the part where it says it’s starting up IPC I believe). Sorry, I can’t recall what settings I gave xf86config for that to happen.

In any case, xf86config doesn’t ask me any questions about dri or hardware accelerated OpenGL. glxinfo tells me that glx isn’t loaded.

Mandrake’s graphical X config program gives me the same sort of results as xf86config.

What I haven’t tried yet is to manually edit XF86Config-4 turning on glx and dri. If anyone could outline what I need to have in there (and where and in which order) I’d greatly appreciate it. Perhaps post the relevant portion(s) of your XF86Config-4?

I’ve heard about an X config program called XF86Setup but it isn’t on my system.

This is really getting my goat because I previously had an nVidia gForce 2 MX 200 (32 MB) but I really wanted to use dri/mesa so I bought the g400 (after looking at the status page on the dri site).

Thanks.

(BTW, the 2D image quality on the matrox is better than the nvidia. Very sharp looking text.)

[This message has been edited by jmg (edited 10-07-2002).]

Unfortunately(for both of us) I haven’t had any experience with flat panels but that mouse problems sure looks interesting.Are you sure you’re loading the correct driver for the mouse?
As for DRI try configuring X manually.For an outline of a configuration try this: http://dri.sourceforge.net/res/XF86Config.g400
Make sure you have the Load “glx” and Load “dri” lines since glxinfo complains tha glx isn’t loaded.Also for further clues as to why dri doesn’t work take a look at /var/log/XFree86.0.log.Load X then search the file from them bottom up for lines containig [dri] or [drm](and you might also want to look at anything MGA related in there).Good luck and post if you any questions.

PS oesn’t the GeForce support DRI?Or did you really want to use the X driver?I thought nvidia drivers were really good.

> Unfortunately(for both of us)

I’ll never go back to CRT.

> I haven’t had any experience with flat panels

Since I’m using the analog input on the flat panel, I believe that you can simply tell X it’s horizontal and vertical refresh rates, preferred resolution – it then just treats it like a CRT. That’s my guess.

> but that mouse
> problems sure looks interesting. Are you sure you’re loading the
> correct driver for the mouse?

When I set the resolution to 800x600 the mouse works fine, and I choose the same mouse settings when changing back to 1024x768, so I assume that it’s the correct mouse driver.

> As for DRI try configuring X manually. For an outline of a configuration
> try this: http://dri.sourceforge.net/res/XF86Config.g400

Wow! Thanks for the great link. I hadn’t found that “res” area of the dri site before. I also hadn’t noticed all the comments associated with some of the faq items.

> Make sure you have the Load “glx” and Load “dri” lines since glxinfo
> complains tha glx isn’t loaded. Also for further clues as to why dri doesn’t
> work take a look at /var/log/XFree86.0.log.

Check.

> Load X then search the file from them bottom up for lines containig [dri] or
> [drm](and you might also want to look at anything MGA related in
> there).Good luck and post if you any questions.

Thanks. I’ll try more when I get home tonight (it’s 3 pm (EST) here now) and post again on this thread.

> PS oesn’t the GeForce support DRI? Or did you really want to use the X
> driver? I thought nvidia drivers were really good.

There are no mesa/dri nVidia drivers at all. NVidia provides drivers (binaries only) that do not use dri or glx. Besides, I wanted to support the dri team by using dri and the mesa team by using mesa. I also want to support matrox for releasing specs and supporting Free drivers for their products (at least I’m under the impression that matrox is the best of the bunch (least worst?) in this regard).

More later.

[This message has been edited by jmg (edited 10-07-2002).]

This follow-up is a bit longish so that it might help out
someone else. The short answer is, it’s working now, but
I don’t have glu.h.

The stock Mandrake 8.2 install set me up with the following
defaults in my X86Config-4:

Section “InputDevice”

Identifier  "Mouse1"
Driver      "mouse"
Option "Protocol"    "IMPS/2"
Option "Device"      "/dev/mouse"
Option "ZAxisMapping" "4 5"

EndSection

So, this “IMPS/2” protocol was probably the problem I was
having with my mouse not working after I was running
x86config earlier. I think that previously it simply said
“PS/2” – not sure.

Mandrake 8.2 comes with Linux 2.4.18 and XFree86 4.2.0.
At the end of the install, I told it I wanted hardware
OpenGL acceleration.

glxinfo reports all’s well:

------cut here------
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.2

client glx vendor string: SGI
client glx version string: 1.2

OpenGL vendor string: VA Linux Systems Inc.
OpenGL renderer string: Mesa DRI G400 20010622 AGP 1x x86/MMX/3DNow!
OpenGL version string: 1.2 Mesa 3.4.2

glu version: 1.3
------cut here------

Looking for the kernel module, I see it’s present:

------cut here------
[john@localhost drm]$ pwd
/lib/modules/2.4.18-6mdk/kernel/drivers/char/drm
[john@localhost drm]$ ls
i810.o.gz i830.o.gz mga.o.gz r128.o.gz radeon.o.gz tdfx.o.gz
------cut here------

Also, the dri device is here:

------cut here------
[john@localhost dri]$ pwd
/dev/dri
[john@localhost dri]$ ls -l
total 0
crw-rw-rw- 1 root root 226, 0 Oct 8 15:34 card0
------cut here------

as well as the XFree86 dri driver:

------cut here------
[john@localhost dri]$ pwd
/usr/X11R6/lib/modules/dri
[john@localhost dri]$ ls
gamma_dri.so* i830_dri.so* r128_dri.so* sis_dri.so*
i810_dri.so* mga_dri.so* radeon_dri.so*
------cut here------

Running lspci shows me that the card is being recognized:

01:00.0 VGA compatible controller: Matrox Graphics, Inc. MGA G400 AGP (rev 04)

which shows

[john@localhost john]$ setpci -s 01:00.0 4.w
0007

which according to the dri docs means that bus mastering is enabled.

As root, executing lsmod shows me

------cut here------
[root@localhost john]# lsmod
Module Size Used by Not tainted
mga 100496 1
[snip]
------cut here------

that the appropriate kernel module is indeed installed.
(I sure wouldn’t have a clue what to do here if it wasn’t.)

Running xdpyinfo yeilds tons of info on X (much snipped):

------cut here------
[john@localhost john]$ xdpyinfo
name of display: :0.0
version number: 11.0
vendor string: Mandrake Linux (XFree86 4.2.0, patch level 9mdk)
vendor release number: 40200000
XFree86 version: 4.2.0
[snip]
------cut here------

of which, the small portion at the top you can use to make
sure what version of XFree you have (you need 4.0 or newer
to use dri).

Finally, looking around for the OpenGL libs, I checked in
/usr/lib to find them not there. Mandrake placed them in
/usr/X11R6/lib instead:

------cut here------
[john@localhost lib]$ pwd
/usr/X11R6/lib
[john@localhost lib]$ ls GL
libGL.so@ libGL.so.1.2* libGLU.so.1.3.401*
libGL.so.1@ libGLU.so.1@ libGLw.a
[john@localhost lib]$ ls Mesa
libOSMesa.so@ libOSMesa.so.3@ libOSMesa.so.3.3*
------cut here------

and the headers were here:

------cut here------
[john@localhost GL]$ pwd
/usr/X11R6/include/GL
[john@localhost GL]$ ls
glext.h GLwDrawAP.h glx.h glxproto.h
gl.h GLwMDrawA.h glxint.h glxtokens.h
GLwDrawA.h GLwMDrawAP.h glxmd.h osmesa.h
------cut here------

Hmm… I can’t find glu.h anywhere:

------cut here------
[john@localhost usr]$ pwd
/usr
[john@localhost usr]$ find . -name gl.h
find: ./lib/Bastille: Permission denied
./X11R6/include/GL/gl.h
[john@localhost usr]$ find . -name glu.h
find: ./lib/Bastille: Permission denied
[john@localhost usr]$
------cut here------

So, why would I have libGLU.so but not have glu.h?

Anyhow, I changed the resolution and the color depth in
XF86Config-4, did not run xf86config, commented out
a few ModeLine lines, changed DefaultColorDepth to 32,
and added “1024x768” to each of my Screen --> Display
Modes lines.

When I tried to startx, I was given an error and told
that this driver didn’t support 32 bit color. I changed
the default to 24 (in vi. Yup, I had to go frontier-
style for a moment there :), and now all looks well.

Next up is to get glut (and glu.h) from mesa3d.org.
Thanks again zen.

So, why would I have libGLU.so but not have glu.h?

This is strange indeed,but then again Mandrake moves in mysterious ways.The best would be to find the package that contains glu.h but I assume you can just get a copy of it as well.

BTW now that you have things straightened out,you shoulf consider giving debian another try when you find the time(and patience).Also I remember reading somewhere about KDE.Try enlightenment,you’ll be surprised at how fast a windowmanager can actually be(if you’ve been using KDE until now that is).

PS:Isn’t config file hacking so much cooler than those stupid config programs(especially when they fail)?

BTW now that you have things straightened out,you shoulf consider giving debian another try when you find the time(and patience).

I believe that there was something wrong with my debian woody CD’s (even though the md5 sums were correct). They would never install one or more of the ppp packages correctly.

On a related note, a friend just handed me a freshly burned slack 8.1 cd.

Try enlightenment,you’ll be surprised at how fast a windowmanager can actually be

I’ve been fiddling around with IceWM and have been impressed so far. It starts up quickly and feels very fast.

PS:Isn’t config file hacking so much cooler than those stupid config programs(especially when they fail)?

Well, I’m grateful that Mandrake’s automatic configuration gave me a good start, but it’s nice to get your hands dirty too.

[This message has been edited by jmg (edited 10-08-2002).]

Just be careful with slack.There are virtually no packages available other than the ones you get on the cd’s.Better get ready for a lot of compiling.That in itself isn’t so bad(especially for learning) but some programs don’t compile correctly so you might have trouble(I never could run dict for example although it seemed to compile ok and I never configured sendmail correctly).Although I like the philosophy(simplicity) of slack it did have some problems on my box.Try it out though it’s going to help you learn a lot about linux(the hard way) in any case.

Just be careful with slack.There are virtually no packages available other
than the ones you get on the cd’s.Better get ready for a lot of compiling.

Tried Slack 8.1. Learned that it’s presumed that you will compile your own custom
kernel after the install (the “bare” default one didn’t support my sound card).
Went back to Mandrake 8.2, for now.

Downloaded both Mesa 4.0.4 bz2 files (the lib and the glut/demos) into my home
directory. bunzip2’d them. Tried to build but found that I goofed up the Mandrake
install: if you lie to the Mandrake installer and tell it you don’t have the
“commercial apps CD1” gcc won’t install correctly. [shrug] Fixed that by removing
and re-installing the rpm’s for gcc 2.96.

Back to Mesa. Ran ./configure. Ran make. Waited. Waited. Done. Ran make check
(builds all the cool demos). Waited. Done. Tested some demos. Yay! Works!

Then, as root, copied the mesa glu.h into /usr/X11R6/include/GL (since Mandrake
didn’t come with it). Copied the libglut.so.3.7.0 into /usr/X11R6/lib. Made some
symlinks in /usr/lib that point to the OpenGL libs in /usr/X11R6/lib:

cd /usr/lib
ln -s /usr/X11R6/lib/libGL.so libGL.so
ln -s /usr/X11R6/lib/libGLU.so libGLU.so
ln -s /usr/X11R6/lib/libglut.so libglut.so

where /usr/X11R6/lib/libFOO.so is really a symlink to the real libFoo.so.i.j.k.

Ran ldconfig as root. And my little glut projects compile and run just fine.

One thing I still don’t get is, even though I have /usr/X11R6/lib in my ld.so.conf,
and even though I ran ldconfig, I still need to have those above symlinks
in my /usr/lib for this:

g++ main.cpp -lglut -lGLU -lGL

to compile. Otherwise, ld complains that it can’t find libglut.so. If anyone can
tell me why, I’d sure appreciate it.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.