1 /*
2 * Copyright (c) 2011, 2019, 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 #ifndef CGLGraphicsConfig_h_Included
27 #define CGLGraphicsConfig_h_Included
28
29 #import "jni.h"
30 #import "J2D_GL/gl.h"
31 #import "OGLSurfaceData.h"
32 #import "OGLContext.h"
33 #import <Cocoa/Cocoa.h>
34
35 @interface GraphicsConfigUtil : NSObject {}
36 + (void) _getCGLConfigInfo: (NSMutableArray *)argValue;
37 @end
38
39 // REMIND: Using an NSOpenGLPixelBuffer as the scratch surface has been
40 // problematic thus far (seeing garbage and flickering when switching
41 // between an NSView and the scratch surface), so the following enables
42 // an alternate codepath that uses a hidden NSWindow/NSView as the scratch
43 // surface, for the purposes of making a context current in certain
44 // situations. It appears that calling [NSOpenGLContext setView] too
45 // frequently contributes to the bad behavior, so we should try to avoid
46 // switching to the scratch surface whenever possible.
47
48 /* Do we need this if we are using all off-screen drawing ? */
49 #define USE_NSVIEW_FOR_SCRATCH 1
50
51 /**
52 * The CGLGraphicsConfigInfo structure contains information specific to a
53 * given CGLGraphicsConfig (pixel format).
54 *
55 * jint screen;
56 * The screen and PixelFormat for the associated CGLGraphicsConfig.
57 *
58 * NSOpenGLPixelFormat *pixfmt;
59 * The pixel format of the native NSOpenGL context.
60 *
61 * OGLContext *context;
62 * The context associated with this CGLGraphicsConfig.
63 */
64 typedef struct _CGLGraphicsConfigInfo {
65 jint screen;
66 NSOpenGLPixelFormat *pixfmt;
67 OGLContext *context;
68 } CGLGraphicsConfigInfo;
69
70 /**
71 * The CGLCtxInfo structure contains the native CGLContext information
72 * required by and is encapsulated by the platform-independent OGLContext
73 * structure.
74 *
75 * NSOpenGLContext *context;
76 * The core native NSOpenGL context. Rendering commands have no effect until
77 * a context is made current (active).
78 *
79 * NSOpenGLPixelBuffer *scratchSurface;
80 * The scratch surface id used to make a context current when we do
81 * not otherwise have a reference to an OpenGL surface for the purposes of
82 * making a context current.
83 */
84 typedef struct _CGLCtxInfo {
85 NSOpenGLContext *context;
86 #if USE_NSVIEW_FOR_SCRATCH
|
1 /*
2 * Copyright (c) 2011, 2020, 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 #ifndef CGLGraphicsConfig_h_Included
27 #define CGLGraphicsConfig_h_Included
28
29 #import "jni.h"
30 #import "J2D_GL/gl.h"
31 #import "OGLSurfaceData.h"
32 #import "OGLContext.h"
33 #import <Cocoa/Cocoa.h>
34
35 // REMIND: Using an NSOpenGLPixelBuffer as the scratch surface has been
36 // problematic thus far (seeing garbage and flickering when switching
37 // between an NSView and the scratch surface), so the following enables
38 // an alternate codepath that uses a hidden NSWindow/NSView as the scratch
39 // surface, for the purposes of making a context current in certain
40 // situations. It appears that calling [NSOpenGLContext setView] too
41 // frequently contributes to the bad behavior, so we should try to avoid
42 // switching to the scratch surface whenever possible.
43
44 /* Do we need this if we are using all off-screen drawing ? */
45 #define USE_NSVIEW_FOR_SCRATCH 1
46
47 /**
48 * The CGLGraphicsConfigInfo structure contains information specific to a
49 * given CGLGraphicsConfig.
50 *
51 * OGLContext *context;
52 * The context associated with this CGLGraphicsConfig.
53 */
54 typedef struct _CGLGraphicsConfigInfo {
55 OGLContext *context;
56 } CGLGraphicsConfigInfo;
57
58 /**
59 * The CGLCtxInfo structure contains the native CGLContext information
60 * required by and is encapsulated by the platform-independent OGLContext
61 * structure.
62 *
63 * NSOpenGLContext *context;
64 * The core native NSOpenGL context. Rendering commands have no effect until
65 * a context is made current (active).
66 *
67 * NSOpenGLPixelBuffer *scratchSurface;
68 * The scratch surface id used to make a context current when we do
69 * not otherwise have a reference to an OpenGL surface for the purposes of
70 * making a context current.
71 */
72 typedef struct _CGLCtxInfo {
73 NSOpenGLContext *context;
74 #if USE_NSVIEW_FOR_SCRATCH
|