< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m

Print this page




 166         if (glMask == 0) {
 167             glMask = CGDisplayIDToOpenGLDisplayMask(displayID);
 168         }
 169 
 170         NSOpenGLPixelFormatAttribute attrs[] = {
 171             NSOpenGLPFAAllowOfflineRenderers,
 172             NSOpenGLPFAClosestPolicy,
 173             NSOpenGLPFAWindow,
 174             NSOpenGLPFAPixelBuffer,
 175             NSOpenGLPFADoubleBuffer,
 176             NSOpenGLPFAColorSize, 32,
 177             NSOpenGLPFAAlphaSize, 8,
 178             NSOpenGLPFADepthSize, 16,
 179             NSOpenGLPFAScreenMask, glMask,
 180             0
 181         };
 182 
 183         sharedPixelFormat =
 184             [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
 185         if (sharedPixelFormat == nil) {
 186             J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL");
















 187             [argValue addObject: [NSNumber numberWithLong: 0L]];
 188             return;
 189         }

 190 
 191         sharedContext =
 192             [[NSOpenGLContext alloc]
 193                 initWithFormat:sharedPixelFormat
 194                 shareContext: NULL];
 195         if (sharedContext == nil) {
 196             J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLContext is NULL");
 197             [argValue addObject: [NSNumber numberWithLong: 0L]];
 198             return;
 199         }
 200     }
 201 
 202 #if USE_NSVIEW_FOR_SCRATCH
 203     NSRect contentRect = NSMakeRect(0, 0, 64, 64);
 204     NSWindow *window =
 205         [[NSWindow alloc]
 206             initWithContentRect: contentRect
 207             styleMask: NSBorderlessWindowMask
 208             backing: NSBackingStoreBuffered
 209             defer: false];




 166         if (glMask == 0) {
 167             glMask = CGDisplayIDToOpenGLDisplayMask(displayID);
 168         }
 169 
 170         NSOpenGLPixelFormatAttribute attrs[] = {
 171             NSOpenGLPFAAllowOfflineRenderers,
 172             NSOpenGLPFAClosestPolicy,
 173             NSOpenGLPFAWindow,
 174             NSOpenGLPFAPixelBuffer,
 175             NSOpenGLPFADoubleBuffer,
 176             NSOpenGLPFAColorSize, 32,
 177             NSOpenGLPFAAlphaSize, 8,
 178             NSOpenGLPFADepthSize, 16,
 179             NSOpenGLPFAScreenMask, glMask,
 180             0
 181         };
 182 
 183         sharedPixelFormat =
 184             [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
 185         if (sharedPixelFormat == nil) {
 186             J2dRlsTraceLn1(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL glMask %0x\n",glMask);
 187             NSOpenGLPixelFormatAttribute attrs1[] = {
 188               NSOpenGLPFAAllowOfflineRenderers,
 189               NSOpenGLPFAClosestPolicy,
 190               NSOpenGLPFAWindow,
 191               NSOpenGLPFAPixelBuffer,
 192               NSOpenGLPFADoubleBuffer,
 193               NSOpenGLPFAColorSize, 32,
 194               NSOpenGLPFAAlphaSize, 8,
 195               NSOpenGLPFADepthSize, 16,
 196               0
 197             };
 198             sharedPixelFormat =
 199                [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs1];
 200             if (sharedPixelFormat == nil) {
 201                 J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL ");
 202                 
 203                [argValue addObject: [NSNumber numberWithLong: 0L]];
 204                return;
 205             }
 206         }
 207 
 208         sharedContext =
 209             [[NSOpenGLContext alloc]
 210                 initWithFormat:sharedPixelFormat
 211                 shareContext: NULL];
 212         if (sharedContext == nil) {
 213             J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLContext is NULL");
 214             [argValue addObject: [NSNumber numberWithLong: 0L]];
 215             return;
 216         }
 217     }
 218 
 219 #if USE_NSVIEW_FOR_SCRATCH
 220     NSRect contentRect = NSMakeRect(0, 0, 64, 64);
 221     NSWindow *window =
 222         [[NSWindow alloc]
 223             initWithContentRect: contentRect
 224             styleMask: NSBorderlessWindowMask
 225             backing: NSBackingStoreBuffered
 226             defer: false];


< prev index next >