Making OpenGL Run Fast
Hardware
To run OpenGL Shader Language (GLSL) programs on your card, you need hardware capable of at least DirectX Pixel Shaders 2.0,
and preferably Pixel Shaders 3.0, which support looping and branching
in hardware. If the hardware supports DirectX pixel shaders,
it'll say so right on the box. If it doesn't mention DirectX, or
just says "DirectX 9 compatible" (what card isn't?), then it probably
doesn't support pixel shaders.
Pixel Shaders 2.0 hardware includes:
- ATI xANYTHING
- ATI Radeon 9550 and above.
Note the 9000, 9200, and 9250 are
not capable of pixel shaders 2.0.
- nVidia GeForce 5000 and above.
- Intel GMA x3000
A low-end but fully programmable card, like the GeForce 5200, or ATI
x300, will cost about $50. Be sure to get the AGP version if your
motherboard has an AGP port, and a PCI-express version if you've got
PCI-express. Plain PCI is tough to find, and not recommended.
There's a nice little online registry of which cards support each OpenGL extension. In particular, check out the list for ARB_shading_language_100, which is GLSL.
Software--Windows
Download the latest driver direct from nVidia or ATI. Install it. You should be good to go!
A good driver is quite important--GLSL generally isn't supported on
drivers more than a year or two old, and so even if your hardware
supports it, your GLSL programs won't run.
Software--Linux
Download the latest "proprietary" driver direct from nVidia or ATI. Install it:
- For nVidia .run file, "chmod +x *.run; ./*.run" as root.
- For ATI .rpm, "rpm --install *.rpm" as root.
You can't upgrade your graphics driver while X is running, so you'll
have either boot into single-user mode ('a' and " single" in GRUB) or
switch to single-user mode (ctrl-alt-F1, log in as root, "/sbin/init
1").
This usually just works, but there are a bunch of pieces to the linux OpenGL driver, and they can all go wrong:
- The proprietary kernel module has to be loaded. "lsmod |
grep nvidia" or "lsmod | grep fglrx" for ATI. If it's not loaded,
reinstall the whole driver. You may have to add the nvidia or
fglrx kernel driver to /etc/sysconfig/kernel or /etc/modules to make it
load at startup.
- The kernel module has to be able to talk to userspace. "ls -al
/dev/nvidia*" or "ls -al /dev/dri/*" for ATI. Check the
permissions--they should be read/write for everybody "crw-rw-rw-
". Try "startx" as root, and run an OpenGL application as root. If it works, your permissions might be wrong.
- The X config file has to load up and talk to the driver.
Check /etc/X11/xorg.conf--the "Device" section should have a "Driver"
of "nvidia" or "fglrx". Make sure the "dri" and "glx" modules are
both loaded. Read /var/log/Xorg.0.log to make sure your X server isn't whining at startup.
- The OpenGL dynamic library has to be correct. Do a "ldd
`which glxgears`" to see which libGL your system is loading.
"strings" on this library should show you "DRI" stuff, or you might
have the wrong libGL.
Back to CS 381, Dr. Lawlor, CS, UAF.