I'm currently porting a library of effects (depth of field, glow, HDR etc.) from Windows to Mac OS and am looking to create floating point framebuffers in Cocoa. The documentation seems straightforward and I've setup and validated a hardware accelerated pixel format as follows...
// ID of main display - running MBP mid-late 07 with 8600M GT GPU with Leopard 5.5
CGDirectDisplayID display = CGMainDisplayID();
GLuint attributes[] =
{
NSOpenGLPFAScreenMask, (NSOpenGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(display),
NSOpenGLPFAWindow,
NSOpenGLPFANoRecovery,
NSOpenGLPFAAccelerated,
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAColorFloat,
NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute)64,
NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)24,
NSOpenGLPFAMinimumPolicy,
0
};
NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: (NSOpenGLPixelFormatAttribute*)attributes];
if (fmt) {
printf("pixel format VALID!\n");
// check details of returned pixel format
GLint noofVirtualScreens = [fmt numberOfVirtualScreens];
GLint colourFloatBuffer, colourSize, alphaSize;
[fmt getValues:&colourFloatBuffer forAttribute:NSOpenGLPFAColorFloat forVirtualScreen:0];
[fmt getValues:&colourSize forAttribute:NSOpenGLPFAColorSize forVirtualScreen:0];
[fmt getValues:&alphaSize forAttribute:NSOpenGLPFAAlphaSize forVirtualScreen:0];
printf("number of virtual screens = %d\n", noofVirtualScreens);
printf("Colour Buffer = %d\n", colourFloatBuffer); // 1=okay
printf("colour size = %d\n", colourSize);
printf("alpha size = %d\n", alphaSize);
}
else
{
printf("pixel format not valid!\n");
}
I seem to get a valid pixel format with a 64 bit colour buffer setup okay. However, on rendering into a subclass of NSView I get nothing at all - just a white b/ground as if the context is not bound to the view. If I remove the NSOpenGLPFAColorFloat flag and set the colour size to 32 I get output as normal.
Has anyone else tried using floating point buffers on the 8600M and run into similar problems? I'm wondering if there are properies of the NSView that need to be changed?
Thanks in advance.
C
// ID of main display - running MBP mid-late 07 with 8600M GT GPU with Leopard 5.5
CGDirectDisplayID display = CGMainDisplayID();
GLuint attributes[] =
{
NSOpenGLPFAScreenMask, (NSOpenGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(display),
NSOpenGLPFAWindow,
NSOpenGLPFANoRecovery,
NSOpenGLPFAAccelerated,
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAColorFloat,
NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute)64,
NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)24,
NSOpenGLPFAMinimumPolicy,
0
};
NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: (NSOpenGLPixelFormatAttribute*)attributes];
if (fmt) {
printf("pixel format VALID!\n");
// check details of returned pixel format
GLint noofVirtualScreens = [fmt numberOfVirtualScreens];
GLint colourFloatBuffer, colourSize, alphaSize;
[fmt getValues:&colourFloatBuffer forAttribute:NSOpenGLPFAColorFloat forVirtualScreen:0];
[fmt getValues:&colourSize forAttribute:NSOpenGLPFAColorSize forVirtualScreen:0];
[fmt getValues:&alphaSize forAttribute:NSOpenGLPFAAlphaSize forVirtualScreen:0];
printf("number of virtual screens = %d\n", noofVirtualScreens);
printf("Colour Buffer = %d\n", colourFloatBuffer); // 1=okay
printf("colour size = %d\n", colourSize);
printf("alpha size = %d\n", alphaSize);
}
else
{
printf("pixel format not valid!\n");
}
I seem to get a valid pixel format with a 64 bit colour buffer setup okay. However, on rendering into a subclass of NSView I get nothing at all - just a white b/ground as if the context is not bound to the view. If I remove the NSOpenGLPFAColorFloat flag and set the colour size to 32 I get output as normal.
Has anyone else tried using floating point buffers on the 8600M and run into similar problems? I'm wondering if there are properies of the NSView that need to be changed?
Thanks in advance.
C