Errata

Leider hat sich im CFXTextureManager (und allen Beispielen welche Texturen nutzen) ein kleiner Speicherfehler eingeschlichen. In der Methode
NSBitmapImageRep *LoadImage(NSString *path, int shouldFlipVertical)
wird das Objekt
bitmapimagerep
nicht wieder gelöscht, hier fehlt ein
autorelease
Richtig muss die Methode so aussehen:
NSBitmapImageRep *LoadImage(NSString *path, int shouldFlipVertical)
{
	NSBitmapImageRep *bitmapimagerep;
	NSImage *image;
	image = [[[NSImage alloc] initWithContentsOfFile: path] autorelease];
	bitmapimagerep = [[NSBitmapImageRep alloc] initWithData:[image TIFFRepresentation]];
	
	if (shouldFlipVertical)
	{
		int bytesPerRow, lowRow, highRow;
		unsigned char *pixelData, *swapRow;
		
		bytesPerRow = [bitmapimagerep bytesPerRow];
		pixelData = [bitmapimagerep bitmapData];
		
		swapRow = (unsigned char *)malloc(bytesPerRow);
		for (lowRow = 0, highRow = [bitmapimagerep pixelsHigh]-1; lowRow < highRow; lowRow++, highRow--)
		{
			memcpy(swapRow, &pixelData[lowRow*bytesPerRow], bytesPerRow);
			memcpy(&pixelData[lowRow*bytesPerRow], &pixelData[highRow*bytesPerRow], bytesPerRow);
			memcpy(&pixelData[highRow*bytesPerRow], swapRow, bytesPerRow);
		}
		free(swapRow);
	}
	
	return [bitmapimagerep autorelease];
}

Vielen Dank an Heiko Kautzor für den Hinweis.