Turns out the layer was not opaque by default, so after setting opaque to 'YES' things started showing.
Something else that was a bit suspicious; after a few renders h3dRender() hung at glDrawRangeElements(), which was being called from CAOpenGLLayer.drawInCGLContext(). A bit of debugging reveals that the CGLPixelFormat is getting recreated after a few renders. After hacking it a bit and delaying horde initialisation and rendering until the secend CGLPixelFormat has been set, every works fine.
i.e. something like:
Code:
@implementation someCAOpenGLLayerSubclass
// ...
-(void)drawInCGLContext:(CGLContextObj)ctx pixelFormat:(CGLPixelFormatObj)pf forLayerTime:(CFTimeInterval)t displayTime:(const CVTimeStamp *)ts
{
// the pf parameter is changed after the first few calls
if(_initialPF)
{
_initialPF = (long)(void*)pf;
}
else if(initialFormat != (long)(void*)pf)
{
// do horde stuff if the pixel format has been re-created
}
[super drawInCGLContext:ctx pixelFormat:pf forLayerTime:t displayTime:ts];
}
For now, I'll just move horde init and cleanup to the overrides for creating/destroying pixel formats.