Ok this part is a pain. I will make it as less painful for you though.
1.) make sure your computer is updated and what not, and also install ia32-libs
We now need to add two repositories to make this work.
2.) add x-swat repositories. (nvidia, intel, fglrx supplied graphics libraries)
“sudo apt-add-repository ppa:ubuntu-x-swat/x-updates”
3.) add bumblebee repositories. (Nvidia Optimus Support http://www.bumblebee-project.org)
“sudo apt-add-repository ppa:bumblebee/stable”
4.) now run “sudo apt-get update”
Ok here is the part where i need to do some further explaining. There is the “nvidia-current”, driver that you can use. I use the “nvidia-experimental-310” driver. I have no problems with it, but it really depends on what you want to use.
5.) so now you need to install your nvidia driver, and bumblebee
“sudo apt-get install nvidia-current bumblebee bumblebee-nvidia linux-headers-generic”
If i remember right it may install a few things such as bbswitch. <– this is to switch from the intel card to the Nvidia card when given the command “optirun” (i will explain soon)
there will now be a process called bumblebeed running. Or if it’s not, the best thing to do is restart the laptop, or you can run “sudo service bumblebeed restart”
So your computer should be running with optimus support in linux! this is where optirun comes in. If everything is working like it should you can test it, with this command in a terminal.
“glxspheres” <— this should start up a window with a ring of balls moving around and the center will have balls being thrown through the center of it. Also notice that it will say your Renderer will be Mesa 3d, which is what your onboard intel card is running.
now if you want to test your Nvidia GT 640M with glxspheres, you must run it like this
“optirun glxspheres” <— this will load up the same window but with your nvidia card instead. You will notice the huge difference in performance.
the command optirun is used in this way. say if i wanted to play openarena, and i wanted to use the nvidia card instead of the intel onboard, i would have to run “optirun openarena“. This would start the game with my nvidia card. You can also use the flags with “optirun” like this “optirun -c yuv openarena” which gives you a few more FPS.
Im gonna add a few more tweaks and fixes to some things that might cause an error in the replies section.