Profiling with CPU-Sampler

Apple’s Xcode comes with a neat profiling tool called CPU Sampler. It helps you identifying time consuming code blocks in your software and is really handy if you need to optimize for optimal performance.

Just recently I tried rewriting OpenGL’s routines that handle matrix calculations as part of a lecture at the university. Pretty soon I came to the conclusion, that I had to optimize my code if I wanted to compete with the implementation provided by OpenGL.

This post presents at quick look at CPU Sampler which helped me making well-founded decisions resulting in a faster implementation.

Continue reading →

OpenGL: triangle with white center

Just recently I’ve learned how to create a triangle with OpenGL that has a white center and colored corners. Since I haven’t found a site explaining how to do this I thought about sharing my solution here.

It’s pretty easy as soon as you know that OpenGL blends the color between vertexes horizontally. Just setting the corners of the triangle to the three fundamental colors (RGB) hoping that the center gets white won’t cut it.

Continue reading →