Added error flag.

Added glGetError.
Added setError helper function.
Added negative width and height check to glViewport.