implemented limited OpenGL state caching
minor optimizations