Package com.ardor3d.framework.jogl
Class JoglCanvasRenderer
java.lang.Object
com.ardor3d.framework.jogl.JoglCanvasRenderer
- All Implemented Interfaces:
CanvasRenderer
-
Field Summary
Modifier and TypeFieldDescriptionprotected Camera
protected CapsUtil
protected com.jogamp.opengl.GLContext
protected DirectNioBuffersSet
protected boolean
protected int
protected JoglRenderer
protected Scene
int
-
Constructor Summary
ConstructorDescriptionJoglCanvasRenderer
(Scene scene) Default constructor, with debug disabled, using the default utility for the capabilities and with context drop and reclaim on draw disabledJoglCanvasRenderer
(Scene scene, boolean useDebug, CapsUtil capsUtil, boolean contextDropAndReclaimOnDrawEnabled) Main constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected JoglContextCapabilities
Creates a new renderer for this canvas rendererboolean
draw()
Draw the current state of the scene.Returns the camera being used by this canvas renderer.com.jogamp.opengl.GLContext
int
Returns the renderer being used by this canvas renderer.getScene()
Returns the scene being used by this canvas renderer.void
init
(DisplaySettings settings, boolean doSwap) void
Have the CanvasRenderer claim the graphics context.void
Have the CanvasRenderer release the graphics context.void
Replaces the camera being used by this canvas renderer.void
setContext
(com.jogamp.opengl.GLContext context) void
setFrameClear
(int buffers) void
Replaces the scene being used by this canvas renderer.
-
Field Details
-
_scene
-
_camera
-
_doSwap
protected boolean _doSwap -
_context
protected com.jogamp.opengl.GLContext _context -
_renderer
-
_frameClear
protected int _frameClear -
_capsUtil
-
_directNioBuffersSet
-
MAX_CONTEXT_GRAB_ATTEMPTS
public int MAX_CONTEXT_GRAB_ATTEMPTS
-
-
Constructor Details
-
JoglCanvasRenderer
Default constructor, with debug disabled, using the default utility for the capabilities and with context drop and reclaim on draw disabled- Parameters:
scene
- data related to the scene (cannot be null)
-
JoglCanvasRenderer
public JoglCanvasRenderer(Scene scene, boolean useDebug, CapsUtil capsUtil, boolean contextDropAndReclaimOnDrawEnabled) Main constructor- Parameters:
scene
- data related to the sceneuseDebug
-true
if debugging is currently enabled for this GLContextcapsUtil
- utility to manage the capabilities (cannot be null)contextDropAndReclaimOnDrawEnabled
-true
if we try to drop and reclaim the context on each frame. It should be set tofalse
for better performance in the general case. It should be set totrue
if and only if the OpenGL context is made current on a thread which is not the default rendering thread of the canvas.
-
-
Method Details
-
makeCurrentContext
Description copied from interface:CanvasRenderer
Have the CanvasRenderer claim the graphics context.- Specified by:
makeCurrentContext
in interfaceCanvasRenderer
- Throws:
Ardor3dException
- if we can not claim the context.
-
releaseCurrentContext
public void releaseCurrentContext()Description copied from interface:CanvasRenderer
Have the CanvasRenderer release the graphics context.- Specified by:
releaseCurrentContext
in interfaceCanvasRenderer
-
createContextCapabilities
-
createRenderer
Description copied from interface:CanvasRenderer
Creates a new renderer for this canvas renderer- Specified by:
createRenderer
in interfaceCanvasRenderer
- Returns:
- a new renderer
-
init
- Specified by:
init
in interfaceCanvasRenderer
-
getContext
public com.jogamp.opengl.GLContext getContext() -
setContext
public void setContext(com.jogamp.opengl.GLContext context) -
draw
public boolean draw()Description copied from interface:CanvasRenderer
Draw the current state of the scene.- Specified by:
draw
in interfaceCanvasRenderer
- Returns:
true
if it has been drawn
-
getCamera
Description copied from interface:CanvasRenderer
Returns the camera being used by this canvas renderer. Modifying the returnedCamera
instance effects the view being rendered, so this method can be used to move the camera, etc.- Specified by:
getCamera
in interfaceCanvasRenderer
- Returns:
- the camera used by this canvas renderer
-
getScene
Description copied from interface:CanvasRenderer
Returns the scene being used by this canvas renderer.- Specified by:
getScene
in interfaceCanvasRenderer
- Returns:
- the camera used by this canvas renderer
-
setScene
Description copied from interface:CanvasRenderer
Replaces the scene being used by this canvas renderer.- Specified by:
setScene
in interfaceCanvasRenderer
- Parameters:
scene
- the scene to use
-
getRenderer
Description copied from interface:CanvasRenderer
Returns the renderer being used by this canvas renderer.- Specified by:
getRenderer
in interfaceCanvasRenderer
- Returns:
- the renderer used by this canvas renderer
-
setCamera
Description copied from interface:CanvasRenderer
Replaces the camera being used by this canvas renderer.- Specified by:
setCamera
in interfaceCanvasRenderer
- Parameters:
camera
- the camera to use
-
getRenderContext
- Specified by:
getRenderContext
in interfaceCanvasRenderer
- Returns:
- the Ardor3D RenderContext associated with this CanvasRenderer.
-
getFrameClear
public int getFrameClear()- Specified by:
getFrameClear
in interfaceCanvasRenderer
- Returns:
- an int representing the buffers to clear at the start of each frame. Default is Renderer.BUFFER_COLOR_AND_DEPTH
-
setFrameClear
public void setFrameClear(int buffers) - Specified by:
setFrameClear
in interfaceCanvasRenderer
- Parameters:
buffers
- an int representing the buffers to clear at the start of each frame. Default is Renderer.BUFFER_COLOR_AND_DEPTH
-