< prev index next >

src/java.desktop/share/classes/sun/java2d/opengl/OGLContext.java

Print this page


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


 147         invalidateContext();
 148         invalidateCurrentContext();
 149 
 150         setScratchSurface(config);
 151 
 152         // restore the state on the native level
 153         rq.ensureCapacity(4);
 154         buf.putInt(RESTORE_STATE);
 155         rq.flushNow();
 156     }
 157 
 158     static class OGLContextCaps extends ContextCapabilities {
 159         /**
 160          * Indicates the presence of the GL_EXT_framebuffer_object extension.
 161          * This cap will only be set if the fbobject system property has been
 162          * enabled and we are able to create an FBO with depth buffer.
 163          */
 164         @Native
 165         static final int CAPS_EXT_FBOBJECT     =
 166                 (CAPS_RT_TEXTURE_ALPHA | CAPS_RT_TEXTURE_OPAQUE);
 167         /** Indicates that the context supports a stored alpha channel. */
 168         @Native
 169         static final int CAPS_STORED_ALPHA     = CAPS_RT_PLAIN_ALPHA;
 170         /** Indicates that the context is doublebuffered. */
 171         @Native
 172         static final int CAPS_DOUBLEBUFFERED   = (FIRST_PRIVATE_CAP << 0);
 173         /**
 174          * Indicates the presence of the GL_ARB_fragment_shader extension.
 175          * This cap will only be set if the lcdshader system property has been
 176          * enabled and the hardware supports the minimum number of texture units
 177          */
 178         @Native
 179         static final int CAPS_EXT_LCD_SHADER   = (FIRST_PRIVATE_CAP << 1);
 180         /**
 181          * Indicates the presence of the GL_ARB_fragment_shader extension.
 182          * This cap will only be set if the biopshader system property has been
 183          * enabled and the hardware meets our minimum requirements.
 184          */
 185         @Native
 186         static final int CAPS_EXT_BIOP_SHADER  = (FIRST_PRIVATE_CAP << 2);
 187         /**
 188          * Indicates the presence of the GL_ARB_fragment_shader extension.
 189          * This cap will only be set if the gradshader system property has been
 190          * enabled and the hardware meets our minimum requirements.
 191          */
 192         @Native
 193         static final int CAPS_EXT_GRAD_SHADER  = (FIRST_PRIVATE_CAP << 3);
 194         /** Indicates the presence of the GL_ARB_texture_rectangle extension. */
 195         @Native
 196         static final int CAPS_EXT_TEXRECT      = (FIRST_PRIVATE_CAP << 4);
 197 
 198         OGLContextCaps(int caps, String adapterId) {
 199             super(caps, adapterId);
 200         }
 201 
 202         @Override
 203         public String toString() {
 204             StringBuilder sb = new StringBuilder(super.toString());
 205             if ((caps & CAPS_EXT_FBOBJECT) != 0) {
 206                 sb.append("CAPS_EXT_FBOBJECT|");
 207             }
 208             if ((caps & CAPS_STORED_ALPHA) != 0) {
 209                 sb.append("CAPS_STORED_ALPHA|");
 210             }
 211             if ((caps & CAPS_DOUBLEBUFFERED) != 0) {
 212                 sb.append("CAPS_DOUBLEBUFFERED|");
 213             }
 214             if ((caps & CAPS_EXT_LCD_SHADER) != 0) {
 215                 sb.append("CAPS_EXT_LCD_SHADER|");
 216             }
 217             if ((caps & CAPS_EXT_BIOP_SHADER) != 0) {
 218                 sb.append("CAPS_BIOP_SHADER|");
 219             }
 220             if ((caps & CAPS_EXT_GRAD_SHADER) != 0) {
 221                 sb.append("CAPS_EXT_GRAD_SHADER|");
 222             }
 223             if ((caps & CAPS_EXT_TEXRECT) != 0) {
 224                 sb.append("CAPS_EXT_TEXRECT|");
 225             }
 226             return sb.toString();
 227         }
 228     }
 229 }
   1 /*
   2  * Copyright (c) 2004, 2015, 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


 147         invalidateContext();
 148         invalidateCurrentContext();
 149 
 150         setScratchSurface(config);
 151 
 152         // restore the state on the native level
 153         rq.ensureCapacity(4);
 154         buf.putInt(RESTORE_STATE);
 155         rq.flushNow();
 156     }
 157 
 158     static class OGLContextCaps extends ContextCapabilities {
 159         /**
 160          * Indicates the presence of the GL_EXT_framebuffer_object extension.
 161          * This cap will only be set if the fbobject system property has been
 162          * enabled and we are able to create an FBO with depth buffer.
 163          */
 164         @Native
 165         static final int CAPS_EXT_FBOBJECT     =
 166                 (CAPS_RT_TEXTURE_ALPHA | CAPS_RT_TEXTURE_OPAQUE);



 167         /** Indicates that the context is doublebuffered. */
 168         @Native
 169         static final int CAPS_DOUBLEBUFFERED   = (FIRST_PRIVATE_CAP << 0);
 170         /**
 171          * Indicates the presence of the GL_ARB_fragment_shader extension.
 172          * This cap will only be set if the lcdshader system property has been
 173          * enabled and the hardware supports the minimum number of texture units
 174          */
 175         @Native
 176         static final int CAPS_EXT_LCD_SHADER   = (FIRST_PRIVATE_CAP << 1);
 177         /**
 178          * Indicates the presence of the GL_ARB_fragment_shader extension.
 179          * This cap will only be set if the biopshader system property has been
 180          * enabled and the hardware meets our minimum requirements.
 181          */
 182         @Native
 183         static final int CAPS_EXT_BIOP_SHADER  = (FIRST_PRIVATE_CAP << 2);
 184         /**
 185          * Indicates the presence of the GL_ARB_fragment_shader extension.
 186          * This cap will only be set if the gradshader system property has been
 187          * enabled and the hardware meets our minimum requirements.
 188          */
 189         @Native
 190         static final int CAPS_EXT_GRAD_SHADER  = (FIRST_PRIVATE_CAP << 3);
 191         /** Indicates the presence of the GL_ARB_texture_rectangle extension. */
 192         @Native
 193         static final int CAPS_EXT_TEXRECT      = (FIRST_PRIVATE_CAP << 4);
 194 
 195         OGLContextCaps(int caps, String adapterId) {
 196             super(caps, adapterId);
 197         }
 198 
 199         @Override
 200         public String toString() {
 201             StringBuilder sb = new StringBuilder(super.toString());
 202             if ((caps & CAPS_EXT_FBOBJECT) != 0) {
 203                 sb.append("CAPS_EXT_FBOBJECT|");
 204             }



 205             if ((caps & CAPS_DOUBLEBUFFERED) != 0) {
 206                 sb.append("CAPS_DOUBLEBUFFERED|");
 207             }
 208             if ((caps & CAPS_EXT_LCD_SHADER) != 0) {
 209                 sb.append("CAPS_EXT_LCD_SHADER|");
 210             }
 211             if ((caps & CAPS_EXT_BIOP_SHADER) != 0) {
 212                 sb.append("CAPS_BIOP_SHADER|");
 213             }
 214             if ((caps & CAPS_EXT_GRAD_SHADER) != 0) {
 215                 sb.append("CAPS_EXT_GRAD_SHADER|");
 216             }
 217             if ((caps & CAPS_EXT_TEXRECT) != 0) {
 218                 sb.append("CAPS_EXT_TEXRECT|");
 219             }
 220             return sb.toString();
 221         }
 222     }
 223 }
< prev index next >