1 /*
2 * Copyright (c) 2003, 2016, 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
88 public Object getProxyKey() {
89 return this;
90 }
91
92 @Override
93 public SurfaceData createManagedSurface(int w, int h, int transparency) {
94 return GLXSurfaceData.createData(this, w, h,
95 getColorModel(transparency),
96 null,
97 OGLSurfaceData.TEXTURE);
98 }
99
100 public static GLXGraphicsConfig getConfig(X11GraphicsDevice device,
101 int visualnum)
102 {
103 if (!X11GraphicsEnvironment.isGLXAvailable()) {
104 return null;
105 }
106
107 long cfginfo = 0;
108 final String ids[] = new String[1];
109 OGLRenderQueue rq = OGLRenderQueue.getInstance();
110 rq.lock();
111 try {
112 // getGLXConfigInfo() creates and destroys temporary
113 // surfaces/contexts, so we should first invalidate the current
114 // Java-level context and flush the queue...
115 OGLContext.invalidateCurrentContext();
116 GLXGetConfigInfo action =
117 new GLXGetConfigInfo(device.getScreen(), visualnum);
118 rq.flushAndInvokeNow(action);
119 cfginfo = action.getConfigInfo();
120 if (cfginfo != 0L) {
121 OGLContext.setScratchSurface(cfginfo);
122 rq.flushAndInvokeNow(new Runnable() {
123 public void run() {
124 ids[0] = OGLContext.getOGLIdString();
125 }
126 });
127 }
128 } finally {
|
1 /*
2 * Copyright (c) 2003, 2018, 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
88 public Object getProxyKey() {
89 return this;
90 }
91
92 @Override
93 public SurfaceData createManagedSurface(int w, int h, int transparency) {
94 return GLXSurfaceData.createData(this, w, h,
95 getColorModel(transparency),
96 null,
97 OGLSurfaceData.TEXTURE);
98 }
99
100 public static GLXGraphicsConfig getConfig(X11GraphicsDevice device,
101 int visualnum)
102 {
103 if (!X11GraphicsEnvironment.isGLXAvailable()) {
104 return null;
105 }
106
107 long cfginfo = 0;
108 final String[] ids = new String[1];
109 OGLRenderQueue rq = OGLRenderQueue.getInstance();
110 rq.lock();
111 try {
112 // getGLXConfigInfo() creates and destroys temporary
113 // surfaces/contexts, so we should first invalidate the current
114 // Java-level context and flush the queue...
115 OGLContext.invalidateCurrentContext();
116 GLXGetConfigInfo action =
117 new GLXGetConfigInfo(device.getScreen(), visualnum);
118 rq.flushAndInvokeNow(action);
119 cfginfo = action.getConfigInfo();
120 if (cfginfo != 0L) {
121 OGLContext.setScratchSurface(cfginfo);
122 rq.flushAndInvokeNow(new Runnable() {
123 public void run() {
124 ids[0] = OGLContext.getOGLIdString();
125 }
126 });
127 }
128 } finally {
|