2011 iMac Keeps Restarting - Safemode NOT Working
So for a couple days now my 2011 iMac has been repeatedly restarting, and I've been unable to access the desktop. It gets to the Apple icon and loading bar then restarts. Holding Shift to boot it into safemode does not work either. It simply turns white and stays that way permanently or proceeds into the loading screen. I haven't downloaded anything sketchy that I know of.
Just before this happened (a matter of a day or two) I was getting a visual glitch where the display would be offset slightly, and to access the far left of the picture I would have to move my cursor to the far right. There would also occasionally be some distortion I can't quite describe, like everything was smeared horizontally. I would assume the display problems are related because this happened right up until the restarting glitch.
I don't know what OS it's on because I'm not sure if it had been updating this whole time. Last I remember it was on Yosemite, but it could have updated to El Capitan or later and I just didn't notice (haven't used OS X for some time now and this has been my secondary computer for the past few years).