< prev index next >

src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java

Print this page


   1 /*
   2  * Copyright (c) 2004, 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


  95 
  96     public Object getProxyKey() {
  97         return this;
  98     }
  99 
 100     public SurfaceData createManagedSurface(int w, int h, int transparency) {
 101         return WGLSurfaceData.createData(this, w, h,
 102                                          getColorModel(transparency),
 103                                          null,
 104                                          OGLSurfaceData.TEXTURE);
 105     }
 106 
 107     public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
 108                                               int pixfmt)
 109     {
 110         if (!wglAvailable) {
 111             return null;
 112         }
 113 
 114         long cfginfo = 0;
 115         final String ids[] = new String[1];
 116         OGLRenderQueue rq = OGLRenderQueue.getInstance();
 117         rq.lock();
 118         try {
 119             // getWGLConfigInfo() creates and destroys temporary
 120             // surfaces/contexts, so we should first invalidate the current
 121             // Java-level context and flush the queue...
 122             OGLContext.invalidateCurrentContext();
 123             WGLGetConfigInfo action =
 124                 new WGLGetConfigInfo(device.getScreen(), pixfmt);
 125             rq.flushAndInvokeNow(action);
 126             cfginfo = action.getConfigInfo();
 127             if (cfginfo != 0L) {
 128                 OGLContext.setScratchSurface(cfginfo);
 129                 rq.flushAndInvokeNow(new Runnable() {
 130                     public void run() {
 131                         ids[0] = OGLContext.getOGLIdString();
 132                     }
 133                 });
 134             }
 135         } finally {


   1 /*
   2  * Copyright (c) 2004, 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


  95 
  96     public Object getProxyKey() {
  97         return this;
  98     }
  99 
 100     public SurfaceData createManagedSurface(int w, int h, int transparency) {
 101         return WGLSurfaceData.createData(this, w, h,
 102                                          getColorModel(transparency),
 103                                          null,
 104                                          OGLSurfaceData.TEXTURE);
 105     }
 106 
 107     public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
 108                                               int pixfmt)
 109     {
 110         if (!wglAvailable) {
 111             return null;
 112         }
 113 
 114         long cfginfo = 0;
 115         final String[] ids = new String[1];
 116         OGLRenderQueue rq = OGLRenderQueue.getInstance();
 117         rq.lock();
 118         try {
 119             // getWGLConfigInfo() creates and destroys temporary
 120             // surfaces/contexts, so we should first invalidate the current
 121             // Java-level context and flush the queue...
 122             OGLContext.invalidateCurrentContext();
 123             WGLGetConfigInfo action =
 124                 new WGLGetConfigInfo(device.getScreen(), pixfmt);
 125             rq.flushAndInvokeNow(action);
 126             cfginfo = action.getConfigInfo();
 127             if (cfginfo != 0L) {
 128                 OGLContext.setScratchSurface(cfginfo);
 129                 rq.flushAndInvokeNow(new Runnable() {
 130                     public void run() {
 131                         ids[0] = OGLContext.getOGLIdString();
 132                     }
 133                 });
 134             }
 135         } finally {


< prev index next >