Hi, ALL,
Hopefully I come to the right place for my question
I am Software Developer and recently I needed to test my program under Mac OSX 10.5.
Unfortunately the program crashed.
During the investigation I found that the culprit is in the following piece of code:
[code]
CGLPixelFormatObj pixelFormatObj ;
GLint numPixelFormats ;
CGLPixelFormatAttribute attribs[] =
{
kCGLPFAFullScreen,
kCGLPFADisplayMask,
(CGLPixelFormatAttribute) 0, /* Display mask bit goes here */
(CGLPixelFormatAttribute) 0
} ;
if ( display == kCGNullDirectDisplay )
display = CGMainDisplayID();
attribs[2] = (CGLPixelFormatAttribute) CGDisplayIDToOpenGLDisplayMask(display);
/* Build a full-screen GL context */
CGError error = CGLChoosePixelFormat( attribs, &pixelFormatObj, &numPixelFormats );
if ( pixelFormatObj == NULL )
return NULL;
[/code]
The error variable is "kNoError", but pixelFormatObj is NULL.
What I am trying to do is to get a screenshot of the current display.
Does anybody know of a good solution to use? Is there a reason why this code perform this way?
Thank you.
0 comments:
Post a Comment