1 /*
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
325 const unsigned char *versionstr = j2d_glGetString(GL_VERSION);
326 if (!OGLContext_IsVersionSupported(versionstr)) {
327 J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: OpenGL 1.2 is required");
328 [NSOpenGLContext clearCurrentContext];
329 [argValue addObject: [NSNumber numberWithLong: 0L]];
330 return;
331 }
332 J2dRlsTraceLn1(J2D_TRACE_INFO, "CGLGraphicsConfig_getCGLConfigInfo: OpenGL version=%s", versionstr);
333
334 jint caps = CAPS_EMPTY;
335 OGLContext_GetExtensionInfo(env, &caps);
336
337 GLint value = 0;
338 [sharedPixelFormat
339 getValues: &value
340 forAttribute: NSOpenGLPFADoubleBuffer
341 forVirtualScreen: contextVirtualScreen];
342 if (value != 0) {
343 caps |= CAPS_DOUBLEBUFFERED;
344 }
345 [sharedPixelFormat
346 getValues: &value
347 forAttribute: NSOpenGLPFAAlphaSize
348 forVirtualScreen: contextVirtualScreen];
349 if (value != 0) {
350 caps |= CAPS_STORED_ALPHA;
351 }
352
353 J2dRlsTraceLn2(J2D_TRACE_INFO,
354 "CGLGraphicsConfig_getCGLConfigInfo: db=%d alpha=%d",
355 (caps & CAPS_DOUBLEBUFFERED) != 0,
356 (caps & CAPS_STORED_ALPHA) != 0);
357
358 // remove before shipping (?)
359 #if 1
360 [sharedPixelFormat
361 getValues: &value
362 forAttribute: NSOpenGLPFAAccelerated
363 forVirtualScreen: contextVirtualScreen];
364 if (value == 0) {
365 [sharedPixelFormat
366 getValues: &value
367 forAttribute: NSOpenGLPFARendererID
368 forVirtualScreen: contextVirtualScreen];
369 fprintf(stderr, "WARNING: GL pipe is running in software mode (Renderer ID=0x%x)\n", (int)value);
370 }
371 #endif
372
373 // 0: the buffers are swapped with no regard to the vertical refresh rate
374 // 1: the buffers are swapped only during the vertical retrace
375 GLint params = swapInterval;
376 [context setValues: ¶ms forParameter: NSOpenGLCPSwapInterval];
|
1 /*
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
325 const unsigned char *versionstr = j2d_glGetString(GL_VERSION);
326 if (!OGLContext_IsVersionSupported(versionstr)) {
327 J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: OpenGL 1.2 is required");
328 [NSOpenGLContext clearCurrentContext];
329 [argValue addObject: [NSNumber numberWithLong: 0L]];
330 return;
331 }
332 J2dRlsTraceLn1(J2D_TRACE_INFO, "CGLGraphicsConfig_getCGLConfigInfo: OpenGL version=%s", versionstr);
333
334 jint caps = CAPS_EMPTY;
335 OGLContext_GetExtensionInfo(env, &caps);
336
337 GLint value = 0;
338 [sharedPixelFormat
339 getValues: &value
340 forAttribute: NSOpenGLPFADoubleBuffer
341 forVirtualScreen: contextVirtualScreen];
342 if (value != 0) {
343 caps |= CAPS_DOUBLEBUFFERED;
344 }
345
346 J2dRlsTraceLn1(J2D_TRACE_INFO,
347 "CGLGraphicsConfig_getCGLConfigInfo: db=%d",
348 (caps & CAPS_DOUBLEBUFFERED) != 0);
349
350 // remove before shipping (?)
351 #if 1
352 [sharedPixelFormat
353 getValues: &value
354 forAttribute: NSOpenGLPFAAccelerated
355 forVirtualScreen: contextVirtualScreen];
356 if (value == 0) {
357 [sharedPixelFormat
358 getValues: &value
359 forAttribute: NSOpenGLPFARendererID
360 forVirtualScreen: contextVirtualScreen];
361 fprintf(stderr, "WARNING: GL pipe is running in software mode (Renderer ID=0x%x)\n", (int)value);
362 }
363 #endif
364
365 // 0: the buffers are swapped with no regard to the vertical refresh rate
366 // 1: the buffers are swapped only during the vertical retrace
367 GLint params = swapInterval;
368 [context setValues: ¶ms forParameter: NSOpenGLCPSwapInterval];
|