Mainly a fix for SP renderer's CMake file

Mainly a fix for SP renderer's CMake file, and some bugs in the SP renderer, but also includes a fix for GL_INVALID_VALUE when using r_showtris 1.

Oh, and I tidied up all the other CMake projects too.