12047
|
1 |
/*
|
|
2 |
* Copyright (c) 2011, 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
|
|
23 |
* questions.
|
|
24 |
*/
|
|
25 |
|
|
26 |
#import <stdlib.h>
|
|
27 |
#import <string.h>
|
|
28 |
#import <ApplicationServices/ApplicationServices.h>
|
|
29 |
#import <JavaNativeFoundation/JavaNativeFoundation.h>
|
|
30 |
|
|
31 |
#import "sun_java2d_opengl_CGLGraphicsConfig.h"
|
|
32 |
|
|
33 |
#import "jni.h"
|
|
34 |
#import "jni_util.h"
|
|
35 |
#import "CGLGraphicsConfig.h"
|
|
36 |
#import "CGLSurfaceData.h"
|
|
37 |
#import "LWCToolkit.h"
|
|
38 |
#import "ThreadUtilities.h"
|
|
39 |
|
|
40 |
#pragma mark -
|
|
41 |
#pragma mark "--- Mac OS X specific methods for GL pipeline ---"
|
|
42 |
|
|
43 |
/**
|
|
44 |
* Disposes all memory and resources associated with the given
|
|
45 |
* CGLGraphicsConfigInfo (including its native OGLContext data).
|
|
46 |
*/
|
|
47 |
void
|
|
48 |
OGLGC_DestroyOGLGraphicsConfig(jlong pConfigInfo)
|
|
49 |
{
|
|
50 |
J2dTraceLn(J2D_TRACE_INFO, "OGLGC_DestroyOGLGraphicsConfig");
|
|
51 |
|
|
52 |
CGLGraphicsConfigInfo *cglinfo =
|
|
53 |
(CGLGraphicsConfigInfo *)jlong_to_ptr(pConfigInfo);
|
|
54 |
if (cglinfo == NULL) {
|
|
55 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
56 |
"OGLGC_DestroyOGLGraphicsConfig: info is null");
|
|
57 |
return;
|
|
58 |
}
|
|
59 |
|
|
60 |
OGLContext *oglc = (OGLContext*)cglinfo->context;
|
|
61 |
if (oglc != NULL) {
|
|
62 |
OGLContext_DestroyContextResources(oglc);
|
|
63 |
|
|
64 |
CGLCtxInfo *ctxinfo = (CGLCtxInfo *)oglc->ctxInfo;
|
|
65 |
if (ctxinfo != NULL) {
|
|
66 |
[NSOpenGLContext clearCurrentContext];
|
|
67 |
[ctxinfo->context clearDrawable];
|
|
68 |
[ctxinfo->context release];
|
|
69 |
if (ctxinfo->scratchSurface != 0) {
|
|
70 |
[ctxinfo->scratchSurface release];
|
|
71 |
}
|
|
72 |
free(ctxinfo);
|
|
73 |
}
|
|
74 |
}
|
|
75 |
|
|
76 |
free(cglinfo);
|
|
77 |
}
|
|
78 |
|
|
79 |
#pragma mark -
|
|
80 |
#pragma mark "--- CGLGraphicsConfig methods ---"
|
|
81 |
|
|
82 |
#ifdef REMOTELAYER
|
|
83 |
mach_port_t JRSRemotePort;
|
|
84 |
int remoteSocketFD = -1;
|
|
85 |
|
|
86 |
static void *JRSRemoteThreadFn(void *data) {
|
|
87 |
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
|
88 |
|
|
89 |
// Negotiate a unix domain socket to communicate the
|
|
90 |
// out of band data: to read the mach port server name, and
|
|
91 |
// subsequently write out the layer ID.
|
|
92 |
static char* sock_path = "/tmp/JRSRemoteDemoSocket";
|
|
93 |
struct sockaddr_un address;
|
|
94 |
int socket_fd, nbytes;
|
|
95 |
int BUFLEN = 256;
|
|
96 |
char buffer[BUFLEN];
|
|
97 |
|
|
98 |
remoteSocketFD = socket(PF_LOCAL, SOCK_STREAM, 0);
|
|
99 |
if (remoteSocketFD < 0) {
|
|
100 |
NSLog(@"socket() failed");
|
|
101 |
return NULL;
|
|
102 |
}
|
|
103 |
memset(&address, 0, sizeof(struct sockaddr_un));
|
|
104 |
address.sun_family = AF_UNIX;
|
|
105 |
memcpy(address.sun_path, sock_path, strlen(sock_path)+1);
|
|
106 |
int tries=0, status=-1;
|
|
107 |
while (status !=0 && tries<600) {
|
|
108 |
status = connect(remoteSocketFD, (struct sockaddr *) &address,
|
|
109 |
sizeof(struct sockaddr_un));
|
|
110 |
if (status != 0) {
|
|
111 |
tries++;
|
|
112 |
NSLog(@"connection attempt %d failed.", tries);
|
|
113 |
usleep(5000000);
|
|
114 |
}
|
|
115 |
}
|
|
116 |
if (status != 0) {
|
|
117 |
NSLog(@"failed to connect");
|
|
118 |
return NULL;
|
|
119 |
}
|
|
120 |
nbytes = read(remoteSocketFD, buffer, BUFLEN);
|
|
121 |
NSString* serverString = [[NSString alloc] initWithUTF8String:buffer];
|
|
122 |
CFRetain(serverString);
|
|
123 |
NSLog(@"Read server name %@", serverString);
|
|
124 |
JRSRemotePort = [JRSRenderServer recieveRenderServer:serverString];
|
|
125 |
NSLog(@"Read server port %d", JRSRemotePort);
|
|
126 |
|
|
127 |
[pool drain];
|
|
128 |
return NULL;
|
|
129 |
}
|
|
130 |
|
|
131 |
void sendLayerID(int layerID) {
|
|
132 |
if (JRSRemotePort == 0 || remoteSocketFD < 0) {
|
|
133 |
NSLog(@"No connection to send ID");
|
|
134 |
return;
|
|
135 |
}
|
|
136 |
int BUFLEN = 256;
|
|
137 |
char buffer[BUFLEN];
|
|
138 |
snprintf(buffer, BUFLEN, "%d", layerID);
|
|
139 |
write(remoteSocketFD, buffer, BUFLEN);
|
|
140 |
}
|
|
141 |
#endif /* REMOTELAYER */
|
|
142 |
|
|
143 |
/**
|
|
144 |
* This is a globally shared context used when creating textures. When any
|
|
145 |
* new contexts are created, they specify this context as the "share list"
|
|
146 |
* context, which means any texture objects created when this shared context
|
|
147 |
* is current will be available to any other context in any other thread.
|
|
148 |
*/
|
|
149 |
NSOpenGLContext *sharedContext = NULL;
|
|
150 |
NSOpenGLPixelFormat *sharedPixelFormat = NULL;
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Attempts to initialize CGL and the core OpenGL library.
|
|
154 |
*/
|
|
155 |
JNIEXPORT jboolean JNICALL
|
|
156 |
Java_sun_java2d_opengl_CGLGraphicsConfig_initCGL
|
|
157 |
(JNIEnv *env, jclass cglgc)
|
|
158 |
{
|
|
159 |
J2dRlsTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_initCGL");
|
|
160 |
|
|
161 |
if (!OGLFuncs_OpenLibrary()) {
|
|
162 |
return JNI_FALSE;
|
|
163 |
}
|
|
164 |
|
|
165 |
if (!OGLFuncs_InitPlatformFuncs() ||
|
|
166 |
!OGLFuncs_InitBaseFuncs() ||
|
|
167 |
!OGLFuncs_InitExtFuncs())
|
|
168 |
{
|
|
169 |
OGLFuncs_CloseLibrary();
|
|
170 |
return JNI_FALSE;
|
|
171 |
}
|
|
172 |
#ifdef REMOTELAYER
|
|
173 |
pthread_t jrsRemoteThread;
|
|
174 |
pthread_create(&jrsRemoteThread, NULL, JRSRemoteThreadFn, NULL);
|
|
175 |
#endif
|
|
176 |
return JNI_TRUE;
|
|
177 |
}
|
|
178 |
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Determines whether the CGL pipeline can be used for a given GraphicsConfig
|
|
182 |
* provided its screen number and visual ID. If the minimum requirements are
|
|
183 |
* met, the native CGLGraphicsConfigInfo structure is initialized for this
|
|
184 |
* GraphicsConfig with the necessary information (pixel format, etc.)
|
|
185 |
* and a pointer to this structure is returned as a jlong. If
|
|
186 |
* initialization fails at any point, zero is returned, indicating that CGL
|
|
187 |
* cannot be used for this GraphicsConfig (we should fallback on an existing
|
|
188 |
* 2D pipeline).
|
|
189 |
*/
|
|
190 |
JNIEXPORT jlong JNICALL
|
|
191 |
Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo
|
|
192 |
(JNIEnv *env, jclass cglgc,
|
|
193 |
jint screennum, jint pixfmt, jint swapInterval)
|
|
194 |
{
|
|
195 |
jlong ret = 0L;
|
|
196 |
JNF_COCOA_ENTER(env);
|
|
197 |
NSMutableArray * retArray = [NSMutableArray arrayWithCapacity:3];
|
|
198 |
[retArray addObject: [NSNumber numberWithInt: (int)screennum]];
|
|
199 |
[retArray addObject: [NSNumber numberWithInt: (int)pixfmt]];
|
|
200 |
[retArray addObject: [NSNumber numberWithInt: (int)swapInterval]];
|
|
201 |
if ([NSThread isMainThread]) {
|
|
202 |
[GraphicsConfigUtil _getCGLConfigInfo: retArray];
|
|
203 |
} else {
|
|
204 |
[GraphicsConfigUtil performSelectorOnMainThread: @selector(_getCGLConfigInfo:) withObject: retArray waitUntilDone: YES];
|
|
205 |
}
|
|
206 |
NSNumber * num = (NSNumber *)[retArray objectAtIndex: 0];
|
|
207 |
ret = (jlong)[num longValue];
|
|
208 |
JNF_COCOA_EXIT(env);
|
|
209 |
return ret;
|
|
210 |
}
|
|
211 |
|
|
212 |
|
|
213 |
|
|
214 |
@implementation GraphicsConfigUtil
|
|
215 |
+ (void) _getCGLConfigInfo: (NSMutableArray *)argValue {
|
|
216 |
AWT_ASSERT_APPKIT_THREAD;
|
|
217 |
|
|
218 |
jint screennum = (jint)[(NSNumber *)[argValue objectAtIndex: 0] intValue];
|
|
219 |
jint pixfmt = (jint)[(NSNumber *)[argValue objectAtIndex: 1] intValue];
|
|
220 |
jint swapInterval = (jint)[(NSNumber *)[argValue objectAtIndex: 2] intValue];
|
|
221 |
JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
|
|
222 |
[argValue removeAllObjects];
|
|
223 |
|
|
224 |
J2dRlsTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_getCGLConfigInfo");
|
|
225 |
|
|
226 |
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
|
227 |
|
|
228 |
CGOpenGLDisplayMask glMask = (CGOpenGLDisplayMask)pixfmt;
|
|
229 |
if (sharedContext == NULL) {
|
|
230 |
if (glMask == 0) {
|
|
231 |
CGDirectDisplayID id =
|
|
232 |
FindCGDirectDisplayIDForScreenIndex(screennum);
|
|
233 |
glMask = CGDisplayIDToOpenGLDisplayMask(id);
|
|
234 |
}
|
|
235 |
|
|
236 |
NSOpenGLPixelFormatAttribute attrs[] = {
|
|
237 |
NSOpenGLPFAClosestPolicy,
|
|
238 |
NSOpenGLPFANoRecovery,
|
|
239 |
NSOpenGLPFAAccelerated,
|
|
240 |
NSOpenGLPFAFullScreen,
|
|
241 |
NSOpenGLPFAWindow,
|
|
242 |
NSOpenGLPFAPixelBuffer,
|
|
243 |
NSOpenGLPFADoubleBuffer,
|
|
244 |
NSOpenGLPFAColorSize, 32,
|
|
245 |
NSOpenGLPFAAlphaSize, 8,
|
|
246 |
NSOpenGLPFADepthSize, 16,
|
|
247 |
NSOpenGLPFAScreenMask, glMask,
|
|
248 |
0
|
|
249 |
};
|
|
250 |
|
|
251 |
sharedPixelFormat =
|
|
252 |
[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
|
|
253 |
if (sharedPixelFormat == nil) {
|
|
254 |
J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL");
|
|
255 |
[argValue addObject: [NSNumber numberWithLong: 0L]];
|
|
256 |
return;
|
|
257 |
}
|
|
258 |
|
|
259 |
sharedContext =
|
|
260 |
[[NSOpenGLContext alloc]
|
|
261 |
initWithFormat:sharedPixelFormat
|
|
262 |
shareContext: NULL];
|
|
263 |
if (sharedContext == nil) {
|
|
264 |
J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLContext is NULL");
|
|
265 |
[argValue addObject: [NSNumber numberWithLong: 0L]];
|
|
266 |
return;
|
|
267 |
}
|
|
268 |
}
|
|
269 |
|
|
270 |
#if USE_NSVIEW_FOR_SCRATCH
|
|
271 |
NSRect contentRect = NSMakeRect(0, 0, 64, 64);
|
|
272 |
NSWindow *window =
|
|
273 |
[[NSWindow alloc]
|
|
274 |
initWithContentRect: contentRect
|
|
275 |
styleMask: NSBorderlessWindowMask
|
|
276 |
backing: NSBackingStoreBuffered
|
|
277 |
defer: false];
|
|
278 |
if (window == nil) {
|
|
279 |
J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: NSWindow is NULL");
|
|
280 |
[argValue addObject: [NSNumber numberWithLong: 0L]];
|
|
281 |
return;
|
|
282 |
}
|
|
283 |
|
|
284 |
NSView *scratchSurface =
|
|
285 |
[[NSView alloc]
|
|
286 |
initWithFrame: contentRect];
|
|
287 |
if (scratchSurface == nil) {
|
|
288 |
J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: NSView is NULL");
|
|
289 |
[argValue addObject: [NSNumber numberWithLong: 0L]];
|
|
290 |
return;
|
|
291 |
}
|
|
292 |
[window setContentView: scratchSurface];
|
|
293 |
#else
|
|
294 |
NSOpenGLPixelBuffer *scratchSurface =
|
|
295 |
[[NSOpenGLPixelBuffer alloc]
|
|
296 |
initWithTextureTarget:GL_TEXTURE_2D
|
|
297 |
textureInternalFormat:GL_RGB
|
|
298 |
textureMaxMipMapLevel:0
|
|
299 |
pixelsWide:64
|
|
300 |
pixelsHigh:64];
|
|
301 |
#endif
|
|
302 |
|
|
303 |
NSOpenGLContext *context =
|
|
304 |
[[NSOpenGLContext alloc]
|
|
305 |
initWithFormat: sharedPixelFormat
|
|
306 |
shareContext: sharedContext];
|
|
307 |
if (context == nil) {
|
|
308 |
J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: NSOpenGLContext is NULL");
|
|
309 |
[argValue addObject: [NSNumber numberWithLong: 0L]];
|
|
310 |
return;
|
|
311 |
}
|
|
312 |
|
|
313 |
GLint contextVirtualScreen = [context currentVirtualScreen];
|
|
314 |
#if USE_NSVIEW_FOR_SCRATCH
|
|
315 |
[context setView: scratchSurface];
|
|
316 |
#else
|
|
317 |
[context
|
|
318 |
setPixelBuffer: scratchSurface
|
|
319 |
cubeMapFace:0
|
|
320 |
mipMapLevel:0
|
|
321 |
currentVirtualScreen: contextVirtualScreen];
|
|
322 |
#endif
|
|
323 |
[context makeCurrentContext];
|
|
324 |
|
|
325 |
// get version and extension strings
|
|
326 |
const unsigned char *versionstr = j2d_glGetString(GL_VERSION);
|
|
327 |
if (!OGLContext_IsVersionSupported(versionstr)) {
|
|
328 |
J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: OpenGL 1.2 is required");
|
|
329 |
[NSOpenGLContext clearCurrentContext];
|
|
330 |
[argValue addObject: [NSNumber numberWithLong: 0L]];
|
|
331 |
return;
|
|
332 |
}
|
|
333 |
J2dRlsTraceLn1(J2D_TRACE_INFO, "CGLGraphicsConfig_getCGLConfigInfo: OpenGL version=%s", versionstr);
|
|
334 |
|
|
335 |
jint caps = CAPS_EMPTY;
|
|
336 |
OGLContext_GetExtensionInfo(env, &caps);
|
|
337 |
|
|
338 |
GLint value = 0;
|
|
339 |
[sharedPixelFormat
|
|
340 |
getValues: &value
|
|
341 |
forAttribute: NSOpenGLPFADoubleBuffer
|
|
342 |
forVirtualScreen: contextVirtualScreen];
|
|
343 |
if (value != 0) {
|
|
344 |
caps |= CAPS_DOUBLEBUFFERED;
|
|
345 |
}
|
|
346 |
[sharedPixelFormat
|
|
347 |
getValues: &value
|
|
348 |
forAttribute: NSOpenGLPFAAlphaSize
|
|
349 |
forVirtualScreen: contextVirtualScreen];
|
|
350 |
if (value != 0) {
|
|
351 |
caps |= CAPS_STORED_ALPHA;
|
|
352 |
}
|
|
353 |
|
|
354 |
J2dRlsTraceLn2(J2D_TRACE_INFO,
|
|
355 |
"CGLGraphicsConfig_getCGLConfigInfo: db=%d alpha=%d",
|
|
356 |
(caps & CAPS_DOUBLEBUFFERED) != 0,
|
|
357 |
(caps & CAPS_STORED_ALPHA) != 0);
|
|
358 |
|
|
359 |
// remove before shipping (?)
|
|
360 |
#if 1
|
|
361 |
[sharedPixelFormat
|
|
362 |
getValues: &value
|
|
363 |
forAttribute: NSOpenGLPFAAccelerated
|
|
364 |
forVirtualScreen: contextVirtualScreen];
|
|
365 |
if (value == 0) {
|
|
366 |
[sharedPixelFormat
|
|
367 |
getValues: &value
|
|
368 |
forAttribute: NSOpenGLPFARendererID
|
|
369 |
forVirtualScreen: contextVirtualScreen];
|
|
370 |
fprintf(stderr, "WARNING: GL pipe is running in software mode (Renderer ID=0x%x)\n", (int)value);
|
|
371 |
}
|
|
372 |
#endif
|
|
373 |
|
|
374 |
// 0: the buffers are swapped with no regard to the vertical refresh rate
|
|
375 |
// 1: the buffers are swapped only during the vertical retrace
|
|
376 |
GLint params = swapInterval;
|
|
377 |
[context setValues: ¶ms forParameter: NSOpenGLCPSwapInterval];
|
|
378 |
|
|
379 |
CGLCtxInfo *ctxinfo = (CGLCtxInfo *)malloc(sizeof(CGLCtxInfo));
|
|
380 |
if (ctxinfo == NULL) {
|
|
381 |
J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGC_InitOGLContext: could not allocate memory for ctxinfo");
|
|
382 |
[NSOpenGLContext clearCurrentContext];
|
|
383 |
[argValue addObject: [NSNumber numberWithLong: 0L]];
|
|
384 |
return;
|
|
385 |
}
|
|
386 |
memset(ctxinfo, 0, sizeof(CGLCtxInfo));
|
|
387 |
ctxinfo->context = context;
|
|
388 |
ctxinfo->scratchSurface = scratchSurface;
|
|
389 |
|
|
390 |
OGLContext *oglc = (OGLContext *)malloc(sizeof(OGLContext));
|
|
391 |
if (oglc == 0L) {
|
|
392 |
J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGC_InitOGLContext: could not allocate memory for oglc");
|
|
393 |
[NSOpenGLContext clearCurrentContext];
|
|
394 |
free(ctxinfo);
|
|
395 |
[argValue addObject: [NSNumber numberWithLong: 0L]];
|
|
396 |
return;
|
|
397 |
}
|
|
398 |
memset(oglc, 0, sizeof(OGLContext));
|
|
399 |
oglc->ctxInfo = ctxinfo;
|
|
400 |
oglc->caps = caps;
|
|
401 |
|
|
402 |
// create the CGLGraphicsConfigInfo record for this config
|
|
403 |
CGLGraphicsConfigInfo *cglinfo = (CGLGraphicsConfigInfo *)malloc(sizeof(CGLGraphicsConfigInfo));
|
|
404 |
if (cglinfo == NULL) {
|
|
405 |
J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: could not allocate memory for cglinfo");
|
|
406 |
[NSOpenGLContext clearCurrentContext];
|
|
407 |
free(oglc);
|
|
408 |
free(ctxinfo);
|
|
409 |
[argValue addObject: [NSNumber numberWithLong: 0L]];
|
|
410 |
return;
|
|
411 |
}
|
|
412 |
memset(cglinfo, 0, sizeof(CGLGraphicsConfigInfo));
|
|
413 |
cglinfo->screen = screennum;
|
|
414 |
cglinfo->pixfmt = sharedPixelFormat;
|
|
415 |
cglinfo->context = oglc;
|
|
416 |
|
|
417 |
[NSOpenGLContext clearCurrentContext];
|
|
418 |
[argValue addObject: [NSNumber numberWithLong:ptr_to_jlong(cglinfo)]];
|
|
419 |
[pool drain];
|
|
420 |
}
|
|
421 |
@end //GraphicsConfigUtil
|
|
422 |
|
|
423 |
|
|
424 |
JNIEXPORT jint JNICALL
|
|
425 |
Java_sun_java2d_opengl_CGLGraphicsConfig_getDefaultPixFmt
|
|
426 |
(JNIEnv *env, jclass cglgc, jint screennum)
|
|
427 |
{
|
|
428 |
J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_getDefaultPixFmt");
|
|
429 |
|
|
430 |
CGDirectDisplayID id = FindCGDirectDisplayIDForScreenIndex(screennum);
|
|
431 |
return (jint)CGDisplayIDToOpenGLDisplayMask(id);
|
|
432 |
}
|
|
433 |
|
|
434 |
JNIEXPORT jint JNICALL
|
|
435 |
Java_sun_java2d_opengl_CGLGraphicsConfig_getOGLCapabilities
|
|
436 |
(JNIEnv *env, jclass cglgc, jlong configInfo)
|
|
437 |
{
|
|
438 |
J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_getOGLCapabilities");
|
|
439 |
|
|
440 |
CGLGraphicsConfigInfo *cglinfo =
|
|
441 |
(CGLGraphicsConfigInfo *)jlong_to_ptr(configInfo);
|
|
442 |
if ((cglinfo == NULL) || (cglinfo->context == NULL)) {
|
|
443 |
return CAPS_EMPTY;
|
|
444 |
} else {
|
|
445 |
return cglinfo->context->caps;
|
|
446 |
}
|
|
447 |
}
|