| 1 | /* | 
|---|
| 2 | * Copyright (c) 2003, 2005, 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 GLXGraphicsConfig_h_Included | 
|---|
| 27 | #define GLXGraphicsConfig_h_Included | 
|---|
| 28 |  | 
|---|
| 29 | #include "jni.h" | 
|---|
| 30 | #include "J2D_GL/glx.h" | 
|---|
| 31 | #include "OGLSurfaceData.h" | 
|---|
| 32 | #include "OGLContext.h" | 
|---|
| 33 |  | 
|---|
| 34 | #ifdef HEADLESS | 
|---|
| 35 | #define GLXGraphicsConfigInfo void | 
|---|
| 36 | #define GLXCtxInfo void | 
|---|
| 37 | #else /* HEADLESS */ | 
|---|
| 38 |  | 
|---|
| 39 | /** | 
|---|
| 40 | * The GLXGraphicsConfigInfo structure contains information specific to a | 
|---|
| 41 | * given GLXGraphicsConfig (visual).  Each AwtGraphicsConfigData struct | 
|---|
| 42 | * associated with a GLXGraphicsConfig contains a pointer to a | 
|---|
| 43 | * GLXGraphicsConfigInfo struct (if it is actually an X11GraphicsConfig, that | 
|---|
| 44 | * pointer value will be NULL). | 
|---|
| 45 | * | 
|---|
| 46 | *     jint screen, visual; | 
|---|
| 47 | * The X11 screen and visual IDs for the associated GLXGraphicsConfig. | 
|---|
| 48 | * | 
|---|
| 49 | *     OGLContext *context; | 
|---|
| 50 | * The context associated with this GLXGraphicsConfig. | 
|---|
| 51 | * | 
|---|
| 52 | *     GLXFBConfig fbconfig; | 
|---|
| 53 | * A handle used in many GLX methods for querying certain attributes of the | 
|---|
| 54 | * GraphicsConfig (visual), creating new GLXContexts, and creating | 
|---|
| 55 | * GLXDrawable surfaces (pbuffers, etc).  Each GraphicsConfig has one | 
|---|
| 56 | * associated GLXFBConfig. | 
|---|
| 57 | */ | 
|---|
| 58 | typedef struct _GLXGraphicsConfigInfo { | 
|---|
| 59 | jint          screen; | 
|---|
| 60 | jint          visual; | 
|---|
| 61 | OGLContext    *context; | 
|---|
| 62 | GLXFBConfig   fbconfig; | 
|---|
| 63 | } GLXGraphicsConfigInfo; | 
|---|
| 64 |  | 
|---|
| 65 | /** | 
|---|
| 66 | * The GLXCtxInfo structure contains the native GLXContext information | 
|---|
| 67 | * required by and is encapsulated by the platform-independent OGLContext | 
|---|
| 68 | * structure. | 
|---|
| 69 | * | 
|---|
| 70 | *     GLXContext context; | 
|---|
| 71 | * The core native GLX context.  Rendering commands have no effect until a | 
|---|
| 72 | * GLXContext is made current (active). | 
|---|
| 73 | * | 
|---|
| 74 | *     GLXFBConfig fbconfig; | 
|---|
| 75 | * This is the same GLXFBConfig that is stored in the GLXGraphicsConfigInfo | 
|---|
| 76 | * whence this GLXContext was created.  It is provided here for convenience. | 
|---|
| 77 | * | 
|---|
| 78 | *     GLXPbuffer  scratchSurface; | 
|---|
| 79 | * The scratch surface, which is used to make a context current when we do | 
|---|
| 80 | * not otherwise have a reference to an OpenGL surface for the purposes of | 
|---|
| 81 | * making a context current. | 
|---|
| 82 | */ | 
|---|
| 83 | typedef struct _GLXCtxInfo { | 
|---|
| 84 | GLXContext  context; | 
|---|
| 85 | GLXFBConfig fbconfig; | 
|---|
| 86 | GLXPbuffer  scratchSurface; | 
|---|
| 87 | } GLXCtxInfo; | 
|---|
| 88 |  | 
|---|
| 89 | jboolean GLXGC_IsGLXAvailable(); | 
|---|
| 90 | VisualID GLXGC_FindBestVisual(JNIEnv *env, jint screen); | 
|---|
| 91 |  | 
|---|
| 92 | #endif /* HEADLESS */ | 
|---|
| 93 |  | 
|---|
| 94 | #endif /* GLXGraphicsConfig_h_Included */ | 
|---|
| 95 |  | 
|---|