net.java.games.jogl.impl

Class GLContextStack


public class GLContextStack
extends java.lang.Object

Implements a stack of GLContext objects along with the initActions that need to be run if their creation is necessary. This is used to detect redundant makeCurrent() calls and to allow one drawable to call display() of another from within the first drawable's display() method.

Method Summary

GLContextInitActionPair
peek()
Returns the top GLContext and associated initialization action without removing it, or null if there is none.
GLContextInitActionPair
peek(int i)
Returns the ith GLContext and associated initialization action from the top without removing it, or null if there is none.
GLContext
peekContext()
Returns the top GLContext without removing it, or null if there is none.
GLContext
peekContext(int i)
Returns the ith GLContext from the top without removing it, or null if there is none.
Runnable
peekInitAction()
Returns the top initialization action without removing it, or null if there is none.
Runnable
peekInitAction(int i)
Returns the ith initialization action from the top without removing it, or null if there is none.
GLContextInitActionPair
pop()
Removes and returns the top GLContext and associated initialization action, or null if there is none.
void
push(GLContext ctx, Runnable initAction)
Pushes this GLContext on the stack.
int
size()
Returns the number of entries on the GLContext stack.

Method Details

peek

public GLContextInitActionPair peek()
Returns the top GLContext and associated initialization action without removing it, or null if there is none.

peek

public GLContextInitActionPair peek(int i)
Returns the ith GLContext and associated initialization action from the top without removing it, or null if there is none.

peekContext

public GLContext peekContext()
Returns the top GLContext without removing it, or null if there is none.

peekContext

public GLContext peekContext(int i)
Returns the ith GLContext from the top without removing it, or null if there is none.

peekInitAction

public Runnable peekInitAction()
Returns the top initialization action without removing it, or null if there is none.

peekInitAction

public Runnable peekInitAction(int i)
Returns the ith initialization action from the top without removing it, or null if there is none.

pop

public GLContextInitActionPair pop()
Removes and returns the top GLContext and associated initialization action, or null if there is none.

push

public void push(GLContext ctx,
                 Runnable initAction)
Pushes this GLContext on the stack. The passed context must be non-null.

size

public int size()
Returns the number of entries on the GLContext stack.