1 /*
2 * Copyright (c) 2005, 2014, 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
34
35 /**
36 * This class contains a number of static utility methods that may be
37 * called (via reflection) by a third-party library, such as JOGL, in order
38 * to interoperate with the OGL-based Java 2D pipeline.
39 *
40 * WARNING: These methods are being made available as a temporary measure
41 * until we offer a more complete, public solution. Like any sun.* class,
42 * this class is not an officially supported public API; it may be modified
43 * at will or removed completely in a future release.
44 */
45 class OGLUtilities {
46
47 /**
48 * These OGL-specific surface type constants are the same as those
49 * defined in the OGLSurfaceData class and are duplicated here so that
50 * clients of this API can access them more easily via reflection.
51 */
52 public static final int UNDEFINED = OGLSurfaceData.UNDEFINED;
53 public static final int WINDOW = OGLSurfaceData.WINDOW;
54 public static final int PBUFFER = OGLSurfaceData.PBUFFER;
55 public static final int TEXTURE = OGLSurfaceData.TEXTURE;
56 public static final int FLIP_BACKBUFFER = OGLSurfaceData.FLIP_BACKBUFFER;
57 public static final int FBOBJECT = OGLSurfaceData.FBOBJECT;
58
59 private OGLUtilities() {
60 }
61
62 /**
63 * Returns true if the current thread is the OGL QueueFlusher thread.
64 */
65 public static boolean isQueueFlusherThread() {
66 return OGLRenderQueue.isQueueFlusherThread();
67 }
68
69 /**
70 * Invokes the given Runnable on the OGL QueueFlusher thread with the
71 * OpenGL context corresponding to the given Graphics object made
72 * current. It is legal for OpenGL code executed in the given
73 * Runnable to change the current OpenGL context; it will be reset
74 * once the Runnable completes. No guarantees are made as to the
|
1 /*
2 * Copyright (c) 2005, 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
34
35 /**
36 * This class contains a number of static utility methods that may be
37 * called (via reflection) by a third-party library, such as JOGL, in order
38 * to interoperate with the OGL-based Java 2D pipeline.
39 *
40 * WARNING: These methods are being made available as a temporary measure
41 * until we offer a more complete, public solution. Like any sun.* class,
42 * this class is not an officially supported public API; it may be modified
43 * at will or removed completely in a future release.
44 */
45 class OGLUtilities {
46
47 /**
48 * These OGL-specific surface type constants are the same as those
49 * defined in the OGLSurfaceData class and are duplicated here so that
50 * clients of this API can access them more easily via reflection.
51 */
52 public static final int UNDEFINED = OGLSurfaceData.UNDEFINED;
53 public static final int WINDOW = OGLSurfaceData.WINDOW;
54 public static final int TEXTURE = OGLSurfaceData.TEXTURE;
55 public static final int FLIP_BACKBUFFER = OGLSurfaceData.FLIP_BACKBUFFER;
56 public static final int FBOBJECT = OGLSurfaceData.FBOBJECT;
57
58 private OGLUtilities() {
59 }
60
61 /**
62 * Returns true if the current thread is the OGL QueueFlusher thread.
63 */
64 public static boolean isQueueFlusherThread() {
65 return OGLRenderQueue.isQueueFlusherThread();
66 }
67
68 /**
69 * Invokes the given Runnable on the OGL QueueFlusher thread with the
70 * OpenGL context corresponding to the given Graphics object made
71 * current. It is legal for OpenGL code executed in the given
72 * Runnable to change the current OpenGL context; it will be reset
73 * once the Runnable completes. No guarantees are made as to the
|