View Single Post
Old 04-07-05, 07:16 AM   #20
jlo
Registered User
 
Join Date: Mar 2005
Posts: 17
Default Re: Doom3 and linux, why doesn't this work?

I made the script which seem to work for me:

/usr/local/sbin/nvidia-use

#!/bin/sh
# Usage: nvidia-use <enable|disable>
# Switch between nvidia and nv use. You need to restart X for "nv"
# (c) GPL by jlo
VERSION="2005.04.07"

if [ "$1" == "enable" ]; then
ln -f -s ../../lib/libGL.so.1.0.7167 /usr/X11R6/lib/libGL.so.1
ln -f -s ../../lib/libGL.so.1.0.7167 /usr/X11R6/lib/libGL.so
perl -pe 's/^\s+Driver\s+\"nv\"\s*$/\tDriver "nvidia"\n/;' -i /etc/X11/xorg.conf
else
ln -f -s libGL.so.1.2 /usr/X11R6/lib/libGL.so.1
ln -f -s libGL.so.1.2 /usr/X11R6/lib/libGL.so
perl -pe 's/^\s+Driver\s+\"nvidia\"\s*$/\tDriver "nv"\n/;' -i /etc/X11/xorg.conf
fi

test:

# nvidia-use enable
$ ldd `which glxgears`|grep GL;ls -l /usr/X11R6/lib/libGL.so.1
libGL.so.1 => /usr/X11R6/lib/libGL.so.1 (0x00d5d000)
libGLcore.so.1 => /usr/lib/libGLcore.so.1 (0x071b8000)
lrwxrwxrwx 1 root root 27 Apr 7 14:13 /usr/X11R6/lib/libGL.so.1 -> ../../lib/libGL.so.1.0.7167

# nvidia-use disable
$ ldd `which glxgears`|grep GL;ls -l /usr/X11R6/lib/libGL.so.1
libGL.so.1 => /usr/X11R6/lib/libGL.so.1 (0x00757000)
lrwxrwxrwx 1 root root 12 Apr 7 14:13 /usr/X11R6/lib/libGL.so.1 -> libGL.so.1.2

Disclaimer: This of course doesn't work if /usr is mounted read only, as it should be able to be. Would have to fiddle with /usr/local/lib to make it _right_.
jlo is offline   Reply With Quote