JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
GLStateKeeper.java
Go to the documentation of this file.
1/**
2 * Copyright 2013 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28package com.jogamp.opengl;
29
30/**
31 * Interface adding a {@link GLEventListenerState} protocol to {@link GLAutoDrawable}s
32 * or other self-contained compound types combining {@link GLDrawable}, {@link GLContext} and {@link GLEventListener}.
33 * <p>
34 * Implementing classes {@link #isGLStatePreservationSupported() may support} preservation
35 * of the {@link GLContext} state and it's associated {@link GLEventListener}.
36 * </p>
37 */
38public interface GLStateKeeper {
39
40 /** Listener for preserve and restore notifications. */
41 public static interface Listener {
42 /** Invoked before preservation. */
44 /** Invoked after restoration. */
46 }
47
48 /**
49 * Sets a {@link Listener}, overriding the old one.
50 * @param l the new {@link Listener}.
51 * @return the previous {@link Listener}.
52 */
54
55 /**
56 * @return <code>true</code> if GL state preservation is supported in implementation and on current platform, <code>false</code> otherwise.
57 * @see #preserveGLStateAtDestroy(boolean)
58 * @see #getPreservedGLState()
59 * @see #clearPreservedGLState()
60 */
62
63 /**
64 * If set to <code>true</code>, the next {@link GLAutoDrawable#destroy()} operation will
65 * {@link #preserveGLEventListenerState() preserve} the {@link GLEventListenerState}.
66 * <p>
67 * This is a one-shot flag, i.e. after preserving the {@link GLEventListenerState},
68 * the flag is cleared.
69 * </p>
70 * <p>
71 * A preserved {@link GLEventListenerState} will be
72 * {@link #restoreGLEventListenerState() restored} again.
73 * </p>
74 * @return <code>true</code> if supported and successful, <code>false</code> otherwise.
75 * @see #isGLStatePreservationSupported()
76 * @see #getPreservedGLState()
77 * @see #clearPreservedGLState()
78 */
79 public boolean preserveGLStateAtDestroy(boolean value);
80
81 /**
82 * Returns the preserved {@link GLEventListenerState} if preservation was performed,
83 * otherwise <code>null</code>.
84 * @see #isGLStatePreservationSupported()
85 * @see #preserveGLStateAtDestroy(boolean)
86 * @see #clearPreservedGLState()
87 */
89
90 /**
91 * Clears the preserved {@link GLEventListenerState} from this {@link GLStateKeeper}, without destroying it.
92 *
93 * @return the preserved and cleared {@link GLEventListenerState} if preservation was performed,
94 * otherwise <code>null</code>.
95 * @see #isGLStatePreservationSupported()
96 * @see #preserveGLStateAtDestroy(boolean)
97 * @see #getPreservedGLState()
98 */
100}
GLEventListenerState is holding GLAutoDrawable components crucial to relocating all its GLEventListen...
Listener for preserve and restore notifications.
void glStateRestored(GLStateKeeper glsk)
Invoked after restoration.
void glStatePreserveNotify(GLStateKeeper glsk)
Invoked before preservation.
Interface adding a GLEventListenerState protocol to GLAutoDrawables or other self-contained compound ...
Listener setGLStateKeeperListener(Listener l)
Sets a Listener, overriding the old one.
GLEventListenerState clearPreservedGLState()
Clears the preserved GLEventListenerState from this GLStateKeeper, without destroying it.
boolean preserveGLStateAtDestroy(boolean value)
If set to true, the next GLAutoDrawable#destroy() operation will preserve the GLEventListenerState.
GLEventListenerState getPreservedGLState()
Returns the preserved GLEventListenerState if preservation was performed, otherwise null.