< 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             J2dRlsTraceLn(J2D_TRACE_ERROR, 
 187                           "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL");
 188             J2dRlsTraceLn1(J2D_TRACE_INFO, "glMask %0x\n",glMask);
 189             NSOpenGLPixelFormatAttribute attrs1[] = {
 190               NSOpenGLPFAAllowOfflineRenderers,
 191               NSOpenGLPFAClosestPolicy,
 192               NSOpenGLPFAWindow,
 193               NSOpenGLPFAPixelBuffer,
 194               NSOpenGLPFADoubleBuffer,
 195               NSOpenGLPFAColorSize, 32,
 196               NSOpenGLPFAAlphaSize, 8,
 197               NSOpenGLPFADepthSize, 16,
 198               0
 199             };
 200             sharedPixelFormat =
 201                [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs1];
 202             if (sharedPixelFormat == nil) {
 203                 J2dRlsTraceLn(J2D_TRACE_ERROR, 
 204                               "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL ");
 205                 
 206                [argValue addObject: [NSNumber numberWithLong: 0L]];
 207                return;
 208             }
 209         }
 210 
 211         sharedContext =
 212             [[NSOpenGLContext alloc]
 213                 initWithFormat:sharedPixelFormat
 214                 shareContext: NULL];
 215         if (sharedContext == nil) {
 216             J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLContext is NULL");
 217             [argValue addObject: [NSNumber numberWithLong: 0L]];
 218             return;
 219         }
 220     }
 221 
 222 #if USE_NSVIEW_FOR_SCRATCH
 223     NSRect contentRect = NSMakeRect(0, 0, 64, 64);
 224     NSWindow *window =
 225         [[NSWindow alloc]
 226             initWithContentRect: contentRect
 227             styleMask: NSBorderlessWindowMask
 228             backing: NSBackingStoreBuffered
 229             defer: false];


< prev index next >