I've been noticing lately that my game sometimes has performance issues, where each frame takes a lot longer than it should to finish. I plugged it into the CPU Sampler in Instruments and found something pretty strange (I think, this is my first time using CPU Sampler so I don't understand all of it).
glClear is apparently taking up an insane amount of CPU time (it currently reads 36%, and is steadily rising). This is a fairly processor-heavy game, so there is no way one call to glClear should be taking up so much time.
glClearColor(backgroundcolor[0], backgroundcolor[1], backgroundcolor[2], 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
This is only called once per frame. I don't have an active stencil buffer, so that's not the problem. One thing that might be problematic is that my game allows you to move off virtually as far as you want in any direction, meaning that your x and y location can get very far from the origin. Does glClear try to clear the entire landscape you've covered or does it only clear the dimensions of the screen? And if that's not a problem, than does anyone know why it is being so expensive on my processor?