Top Description Fields Constructors Methods
org.lwjgl.opengl

pack-priv final Class ContextGL

extends Object
implements Context
Class Inheritance
All Implemented Interfaces
org.lwjgl.opengl.Context
Imports
org.lwjgl.LWJGLException, .LWJGLUtil, .PointerBuffer, .Sys, org.lwjgl.opencl.KHRGLSharing, .APPLEGLSharing, java.nio.ByteBuffer, .IntBuffer

Context encapsulates an OpenGL context.

This class is thread-safe.

Author
elias_naur
Version
$Revision$ $Id$

Field Summary

Modifier and TypeField and Description
private final ContextAttribs
private static final ThreadLocal<ContextGL>
current_context_local

The current Context

private boolean
private boolean
destroyed

Whether the context has been destroyed

private final boolean
private final ByteBuffer
handle

Handle to the native GL rendering context

private static final ContextImplementation
implementation

The platform specific implementation of context methods

private final PeerInfo
private Thread
thread

The thread that has this context current, or null.

Constructor Summary

AccessConstructor and Description
pack-priv
ContextGL(PeerInfo peer_info, ContextAttribs attribs, ContextGL shared_context)

Create a context with the specified peer info and shared context

Method Summary

Modifier and TypeMethod and Description
private boolean
private void
private void
private static ContextImplementation
public synchronized void
destroy()

Request destruction of the Context.

public synchronized void
forceDestroy()

Destroy the context.

pack-priv ContextAttribs
pack-priv static ContextGL
pack-priv ByteBuffer
pack-priv PeerInfo
public synchronized boolean
isCurrent()

Implements org.lwjgl.opengl.Context.isCurrent.

Query whether the context is current
public synchronized void
makeCurrent()

Implements org.lwjgl.opengl.Context.makeCurrent.

Make the context current
public void
releaseCurrent()

Implements org.lwjgl.opengl.Context.releaseCurrent.

Release the current context (if any).
public synchronized void
releaseDrawable()

Implements org.lwjgl.opengl.Context.releaseDrawable.

Release the context from its drawable.
public synchronized void
public static void
setSwapInterval(int value)

Set the buffer swap interval.

public static void
swapBuffers()

Swap the buffers on the current context.

public synchronized void
update()

Update the context.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextAttribsback to summary
private final ContextAttribs contextAttribs
current_context_localback to summary
private static final ThreadLocal<ContextGL> current_context_local

The current Context

destroy_requestedback to summary
private boolean destroy_requested
destroyedback to summary
private boolean destroyed

Whether the context has been destroyed

forwardCompatibleback to summary
private final boolean forwardCompatible
handleback to summary
private final ByteBuffer handle

Handle to the native GL rendering context

implementationback to summary
private static final ContextImplementation implementation

The platform specific implementation of context methods

peer_infoback to summary
private final PeerInfo peer_info
threadback to summary
private Thread thread

The thread that has this context current, or null.

Constructor Detail

ContextGLback to summary
pack-priv ContextGL(PeerInfo peer_info, ContextAttribs attribs, ContextGL shared_context) throws LWJGLException

Create a context with the specified peer info and shared context

Method Detail

canAccessback to summary
private boolean canAccess()
checkAccessback to summary
private void checkAccess()
checkDestroyback to summary
private void checkDestroy()
createImplementationback to summary
private static ContextImplementation createImplementation()
destroyback to summary
public synchronized void destroy() throws LWJGLException

Request destruction of the Context. If the context is current, no context will be current after this call. The context is destroyed when no thread has it current.

forceDestroyback to summary
public synchronized void forceDestroy() throws LWJGLException

Destroy the context. This method behaves the same as destroy() with the extra requirement that the context must be either current to the current thread or not current at all.

getContextAttribsback to summary
pack-priv ContextAttribs getContextAttribs()
getCurrentContextback to summary
pack-priv static ContextGL getCurrentContext()
getHandleback to summary
pack-priv ByteBuffer getHandle()
getPeerInfoback to summary
pack-priv PeerInfo getPeerInfo()
isCurrentback to summary
public synchronized boolean isCurrent() throws LWJGLException

Implements org.lwjgl.opengl.Context.isCurrent.

Query whether the context is current

makeCurrentback to summary
public synchronized void makeCurrent() throws LWJGLException

Implements org.lwjgl.opengl.Context.makeCurrent.

Make the context current

releaseCurrentback to summary
public void releaseCurrent() throws LWJGLException

Implements org.lwjgl.opengl.Context.releaseCurrent.

Release the current context (if any). After this call, no context is current.

releaseDrawableback to summary
public synchronized void releaseDrawable() throws LWJGLException

Implements org.lwjgl.opengl.Context.releaseDrawable.

Release the context from its drawable. This is necessary on some platforms, like Mac OS X, where binding the context to a drawable and binding the context for rendering are two distinct actions and where calling releaseDrawable on every releaseCurrentContext results in artifacts.

setCLSharingPropertiesback to summary
public synchronized void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException
setSwapIntervalback to summary
public static void setSwapInterval(int value)

Set the buffer swap interval. This call is a best-attempt at changing the monitor swap interval, which is the minimum periodicity of color buffer swaps, measured in video frame periods, and is not guaranteed to be successful.

A video frame period is the time required to display a full frame of video data.

swapBuffersback to summary
public static void swapBuffers() throws LWJGLException

Swap the buffers on the current context. Only valid for double-buffered contexts

updateback to summary
public synchronized void update()

Update the context. Should be called whenever it's drawable is moved or resized