Macbook Pro display glitches and laptop freezes
I have a 2012 15" MacBook Pro running Lion. Sometimes the screen glitches out, gray lines appear on it then my computer freezes and must be restarted sometimes it will beep 3 times when restarting and other times it won't. It happens mostly when I open programs like iMovie, Photoshop, VMware Fusion, and one time, Spotify. Is this a virus, software issue, etc? An error message usually appears after being restarted. It does it all the time please help.
MacBook Pro, OS X Mountain Lion (10.8.5)