EDIT: For other poor souls like me with an Nvidia Optimus card please look into using the bumblebee graphics package as from my experience it is by far the most stable. You do have the inconvenience of needing to set which programs use your Nvidia card and which do not, but this is minor in comparison to your desktop freezing every 5 minutes (in my experience anyway).
Seems I was wrong again. I found that after closer inspection the bumblebee drivers were causing errors with X Server. I decided to give the Nvidia drivers a go again and found this solved the errors with the scene rendered as expected and no need for manually executing a program with the command:
optirun
I followed these steps:
*NOTE* Make sure you have the nouveau driver installed so you can use it after purging Nvidia drivers.
1. First select the nouveau driver from Software Settings -> Software and Updates -> Additional Drivers.
Now purge all Nvidia and bumblebee driver/packages:
sudo apt-get purge bumblebee*
sudo apt-get pruge nvidia-*
2. Reboot
3. After reboot reinstall the nvidia-331, nvidia-prime and nvidia-settings drivers/packages.
On Ubuntu 14.04 you can do this easily using the top right menu. Navigate to "Software Settings" -> "Software and Updates" -> "Additional Drivers" and select Nvidia 331-113. This will install the listed packages. Other distros can just use repositories I guess.
4. Reboot Again.
5. After reboot you should be able to run the command:
nvidia-settings
This will bring up the settings for you Nvidia GPU, you may need to change the performance settings under "PRIME profiles" and here you set the GPU. This may take logging in and out to take effect.
6. From here everything should work fine, well it is for me so far...
I found this guide useful:
https://afterhourscoding.wordpress.com/2014/04/30/dell-l502x-optimus-support-on-ubuntu-14-04/Haize