FROM : John Harper
DATE : Wed Apr 02 22:19:07 2008
Hi,
yes, that seems like a good solution,
John
On Apr 2, 2008, at 12:23 PM, Stefan Hafeneger wrote:
> Hi John,
>
> I now setup the environment in copyCGLContextForPixelFormat. The
> folling code seemd to work fine. Do you see anything that would
> create a crash or is this okay? The code should work if the view
> moves from one screen to another, shouldn't it?
>
> [CODE]
> - (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask {
> CGLPixelFormatAttribute attributes[] =
> {
> kCGLPFADisplayMask, mask,
> kCGLPFAAccelerated,
> kCGLPFAColorSize, 24,
> kCGLPFAAlphaSize, 8,
> kCGLPFADepthSize, 16,
> kCGLPFANoRecovery,
> kCGLPFAMultisample,
> kCGLPFASupersample,
> kCGLPFASampleAlpha,
> 0
> };
> CGLPixelFormatObj pixelFormatObj = NULL;
> GLint numPixelFormats = 0;
> CGLChoosePixelFormat(attributes, &pixelFormatObj, &numPixelFormats);
> if(pixelFormatObj == NULL)
> NSLog(@"Error: Could not choose pixel format!");
> return pixelFormatObj;
> }
>
> - (void)releaseCGLPixelFormat:(CGLPixelFormatObj)pixelFormat {
> CGLDestroyPixelFormat(pixelFormat);
> }
>
> - (CGLContextObj)copyCGLContextForPixelFormat:
> (CGLPixelFormatObj)pixelFormat {
> CGLContextObj contextObj = NULL;
> CGLCreateContext(pixelFormat, NULL, &contextObj);
> if(contextObj == NULL)
> NSLog(@"Error: Could not create context!");
>
> CGLSetCurrentContext(contextObj);
>
> //
> // Setup OpenGL environment.
> //
>
> return contextObj;
> }
>
> - (void)releaseCGLContext:(CGLContextObj)glContext {
>
> //
> // Clean up OpenGL environment.
> //
>
> CGLDestroyContext(glContext);
> }
> [/CODE]
>
> With best wishes, Stefan
DATE : Wed Apr 02 22:19:07 2008
Hi,
yes, that seems like a good solution,
John
On Apr 2, 2008, at 12:23 PM, Stefan Hafeneger wrote:
> Hi John,
>
> I now setup the environment in copyCGLContextForPixelFormat. The
> folling code seemd to work fine. Do you see anything that would
> create a crash or is this okay? The code should work if the view
> moves from one screen to another, shouldn't it?
>
> [CODE]
> - (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask {
> CGLPixelFormatAttribute attributes[] =
> {
> kCGLPFADisplayMask, mask,
> kCGLPFAAccelerated,
> kCGLPFAColorSize, 24,
> kCGLPFAAlphaSize, 8,
> kCGLPFADepthSize, 16,
> kCGLPFANoRecovery,
> kCGLPFAMultisample,
> kCGLPFASupersample,
> kCGLPFASampleAlpha,
> 0
> };
> CGLPixelFormatObj pixelFormatObj = NULL;
> GLint numPixelFormats = 0;
> CGLChoosePixelFormat(attributes, &pixelFormatObj, &numPixelFormats);
> if(pixelFormatObj == NULL)
> NSLog(@"Error: Could not choose pixel format!");
> return pixelFormatObj;
> }
>
> - (void)releaseCGLPixelFormat:(CGLPixelFormatObj)pixelFormat {
> CGLDestroyPixelFormat(pixelFormat);
> }
>
> - (CGLContextObj)copyCGLContextForPixelFormat:
> (CGLPixelFormatObj)pixelFormat {
> CGLContextObj contextObj = NULL;
> CGLCreateContext(pixelFormat, NULL, &contextObj);
> if(contextObj == NULL)
> NSLog(@"Error: Could not create context!");
>
> CGLSetCurrentContext(contextObj);
>
> //
> // Setup OpenGL environment.
> //
>
> return contextObj;
> }
>
> - (void)releaseCGLContext:(CGLContextObj)glContext {
>
> //
> // Clean up OpenGL environment.
> //
>
> CGLDestroyContext(glContext);
> }
> [/CODE]
>
> With best wishes, Stefan
| Related mails | Author | Date |
|---|---|---|
| Stefan Hafeneger | Mar 29, 17:01 | |
| John Harper | Mar 31, 05:27 | |
| Stefan Hafeneger | Apr 2, 21:23 | |
| John Harper | Apr 2, 22:19 | |
| Stefan Hafeneger | Apr 2, 22:26 |






Cocoa mail archive

