Developer Forums relocated!

Need help with Apple Developer tools and technologies? Want to share information with other developers and Apple engineers? Visit Developer Forums at Apple.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

I need a solution for 10.5 Mac OS

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.

Mac mini, Mac OS X (10.5.8)

Posted on Jan 7, 2013 10:15 AM

Reply
9 replies

Jan 7, 2013 1:56 PM in response to oneeyeman

FWIW, this gets me one CGLPixelFormatObject on my Mountain Lion system.



        //    if ( display == kCGNullDirectDisplay )
    CGDirectDisplayID display = CGMainDisplayID();
    attribs[2] = (CGLPixelFormatAttribute) CGDisplayIDToOpenGLDisplayMask(display);
    
    
    /* Build a full-screen GL context */
    CGError error = CGLChoosePixelFormat( attribs, &pixelFormatObj, &numPixelFormats );

I need a solution for 10.5 Mac OS

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.