Package com.ardor3d.renderer
Class RenderContext
java.lang.Object
com.ardor3d.renderer.RenderContext
- Direct Known Subclasses:
JoglRenderContext
Represents the state of an individual context in OpenGL.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ContextCapabilities
protected final Object
The object tied to this RenderContext, such as the Canvas, etc.protected Camera
protected final EnumMap
<RenderState.StateType, RenderState> RenderStates a Spatial contains during rendering.protected final Stack
<EnumMap<RenderState.StateType, RenderState>> protected final EnumMap
<RenderState.StateType, RenderState> List of states that override any set states on a spatial if not null.protected final Object
Basically this object represents the sharable portion of a GL context...protected final LineRecord
protected final RendererRecord
protected final EnumMap
<RenderState.StateType, StateRecord> protected final Stack
<AbstractFBOTextureRenderer> -
Constructor Summary
ConstructorDescriptionRenderContext
(Object key, ContextCapabilities caps) RenderContext
(Object key, ContextCapabilities caps, RenderContext shared) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
sets all current states to null, and therefore forces the use of the default states.void
Clears an enforced render state index by setting it to null.void
sets all enforced states to null.void
Should only be called on a thread with an active context.protected RendererRecord
void
enforceState
(RenderState state) Enforce a particular state.void
Enforces the states referenced in the given EnumMap.boolean
void
void
Restores the enforced states from the stack.void
void
Saves the currently set states to a stack.void
void
setCurrentCamera
(Camera cam) void
setCurrentState
(RenderState.StateType type, RenderState state) protected void
-
Field Details
-
_enforcedStates
List of states that override any set states on a spatial if not null. -
_enforcedBackStack
-
_textureRenderers
-
_currentStates
RenderStates a Spatial contains during rendering. -
_stateRecords
-
_lineRecord
-
_rendererRecord
-
_glContextRep
Basically this object represents the sharable portion of a GL context... Textures, displayLists, etc. -
_capabilities
-
_contextKey
The object tied to this RenderContext, such as the Canvas, etc. -
_currentCamera
-
-
Constructor Details
-
RenderContext
-
RenderContext
-
-
Method Details
-
createRendererRecord
-
setupRecords
protected void setupRecords() -
invalidateStates
public void invalidateStates() -
getCapabilities
-
getStateRecord
-
getLineRecord
-
getRendererRecord
-
enforceState
Enforce a particular state. In other words, the given state will override any state of the same type set on a scene object. Remember to clear the state when done enforcing. Very useful for multipass techniques where multiple sets of states need to be applied to a scenegraph drawn multiple times.- Parameters:
state
- state to enforce
-
enforceStates
Enforces the states referenced in the given EnumMap.- Parameters:
states
- the render states
-
clearEnforcedState
Clears an enforced render state index by setting it to null. This allows object specific states to be used.- Parameters:
type
- The type of RenderState to clear enforcement on.
-
clearEnforcedStates
public void clearEnforcedStates()sets all enforced states to null. -
clearCurrentStates
public void clearCurrentStates()sets all current states to null, and therefore forces the use of the default states. -
clearCurrentState
- Parameters:
type
- the state type to clear.
-
hasEnforcedStates
public boolean hasEnforcedStates() -
getEnforcedState
-
getCurrentState
-
getContextKey
-
setCurrentState
-
getCurrentCamera
-
setCurrentCamera
-
getGlContextRep
-
pushEnforcedStates
public void pushEnforcedStates()Saves the currently set states to a stack. Does not changes the currently enforced states. -
popEnforcedStates
public void popEnforcedStates()Restores the enforced states from the stack. Any states enforced or cleared since the last push are reverted.- Throws:
EmptyStackException
- if this method is called without first callingpushEnforcedStates()
-
pushFBOTextureRenderer
-
popFBOTextureRenderer
public void popFBOTextureRenderer() -
contextLost
public void contextLost()Should only be called on a thread with an active context.
-