Fix some compilation issues...

... when threads and OpenGL support are off.