Path: blob/master/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.h
41159 views
/*1* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef CGLGraphicsConfig_h_Included26#define CGLGraphicsConfig_h_Included2728#import "jni.h"29#import "J2D_GL/gl.h"30#import "OGLSurfaceData.h"31#import "OGLContext.h"32#import <Cocoa/Cocoa.h>3334// REMIND: Using an NSOpenGLPixelBuffer as the scratch surface has been35// problematic thus far (seeing garbage and flickering when switching36// between an NSView and the scratch surface), so the following enables37// an alternate codepath that uses a hidden NSWindow/NSView as the scratch38// surface, for the purposes of making a context current in certain39// situations. It appears that calling [NSOpenGLContext setView] too40// frequently contributes to the bad behavior, so we should try to avoid41// switching to the scratch surface whenever possible.4243/* Do we need this if we are using all off-screen drawing ? */44#define USE_NSVIEW_FOR_SCRATCH 14546/**47* The CGLGraphicsConfigInfo structure contains information specific to a48* given CGLGraphicsConfig.49*50* OGLContext *context;51* The context associated with this CGLGraphicsConfig.52*/53typedef struct _CGLGraphicsConfigInfo {54OGLContext *context;55} CGLGraphicsConfigInfo;5657/**58* The CGLCtxInfo structure contains the native CGLContext information59* required by and is encapsulated by the platform-independent OGLContext60* structure.61*62* NSOpenGLContext *context;63* The core native NSOpenGL context. Rendering commands have no effect until64* a context is made current (active).65*66* NSOpenGLPixelBuffer *scratchSurface;67* The scratch surface id used to make a context current when we do68* not otherwise have a reference to an OpenGL surface for the purposes of69* making a context current.70*/71typedef struct _CGLCtxInfo {72NSOpenGLContext *context;73#if USE_NSVIEW_FOR_SCRATCH74NSView *scratchSurface;75#else76NSOpenGLPixelBuffer *scratchSurface;77#endif78} CGLCtxInfo;7980#endif /* CGLGraphicsConfig_h_Included */818283