Archive for the 'Cocoa' Category

Avoiding OpenGL frame tearing on OS X

If you are writing OpenGL code for OS X and you are using NSOpenGL or CGL (Core OpenGL), you may notice you get frame tearing (meaning you can see the view port updating with the naked eye) even if you are using glutSwapBuffers.

The solution is to set a CGL option that syncs the vsynch to the current display frame rate so that you avoid tearing. In your drawing code, just before your glFlush (or equivalent), add the following code:

GLint swapInterval = 1;
CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &swapInterval);

Detecting conflicting Objective-C category methods

Using the new NSDateFormatter

Subclassing in Interface Builder 3

Nerd Post: Storing instance variables in static hash table

GPMethods now available

Nerd Post: Why do different Cocoa objects have the same address?

Nerd Post: EXC_BAD_ACCESS