My laptop has Nvidia Optimus, so I have to use "optirun" if I want run a program on the Nvidia video card. If I don't TF2 will start on the Intel card, and will always show up shader compilation errors.
The problem is that optirun doesn't work for TF2 for some reason:
$ LANG=C LC_NUMERIC=C SteamAppId=440 optirun --debug ./hl2.sh -dev -console -game tf -novid
[ 5336.289984] [DEBUG]optirun version 3.0.1 starting...
[ 5336.290026] [DEBUG]Active configuration:
[ 5336.290030] [DEBUG] bumblebeed config file: /etc/bumblebee/bumblebee.conf
[ 5336.290034] [DEBUG] X display: :8
[ 5336.290037] [DEBUG] LD_LIBRARY_PATH: /usr/lib/nvidia-current:/usr/lib32/nvidia-current
[ 5336.290041] [DEBUG] Socket path: /var/run/bumblebee.socket
[ 5336.290044] [DEBUG] VGL Compression: proxy
[ 5340.133608] [INFO]Response: Yes. X is active.
[ 5340.133626] [INFO]Running application through vglrun.
[ 5340.133741] [DEBUG]Process vglrun started, PID 6144.
Xlib: extension "NV-GLX" missing on display ":0.0".
X Error of failed request: BadAlloc (insufficient resources for operation)
Major opcode of failed request: 154 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Serial number of failed request: 75
Current serial number in output stream: 76
[ 5340.334186] [DEBUG]SIGCHILD received, but wait failed with No child processes
[ 5340.334245] [DEBUG]Socket closed.
[ 5340.334272] [DEBUG]Killing all remaining processes.
It works fine for some other games such as Urban Terror.
It will run if I specify DISPLAY=:8, but this is not an option as there won't be any video output.