Class JoglCanvasRenderer

java.lang.Object
com.ardor3d.framework.jogl.JoglCanvasRenderer
All Implemented Interfaces:
CanvasRenderer

public class JoglCanvasRenderer extends Object implements CanvasRenderer
  • Field Details

    • _scene

      protected Scene _scene
    • _camera

      protected Camera _camera
    • _doSwap

      protected boolean _doSwap
    • _context

      protected com.jogamp.opengl.GLContext _context
    • _renderer

      protected JoglRenderer _renderer
    • _frameClear

      protected int _frameClear
    • _capsUtil

      protected CapsUtil _capsUtil
    • _directNioBuffersSet

      protected DirectNioBuffersSet _directNioBuffersSet
    • MAX_CONTEXT_GRAB_ATTEMPTS

      public int MAX_CONTEXT_GRAB_ATTEMPTS
  • Constructor Details

    • JoglCanvasRenderer

      public JoglCanvasRenderer(Scene scene)
      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 scene
      useDebug - true if debugging is currently enabled for this GLContext
      capsUtil - 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 to false for better performance in the general case. It should be set to true 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

      public void makeCurrentContext() throws Ardor3dException
      Description copied from interface: CanvasRenderer
      Have the CanvasRenderer claim the graphics context.
      Specified by:
      makeCurrentContext in interface CanvasRenderer
      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 interface CanvasRenderer
    • createContextCapabilities

      protected JoglContextCapabilities createContextCapabilities()
    • createRenderer

      public JoglRenderer createRenderer()
      Description copied from interface: CanvasRenderer
      Creates a new renderer for this canvas renderer
      Specified by:
      createRenderer in interface CanvasRenderer
      Returns:
      a new renderer
    • init

      public void init(DisplaySettings settings, boolean doSwap)
      Specified by:
      init in interface CanvasRenderer
    • 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 interface CanvasRenderer
      Returns:
      true if it has been drawn
    • getCamera

      public Camera getCamera()
      Description copied from interface: CanvasRenderer
      Returns the camera being used by this canvas renderer. Modifying the returned Camera instance effects the view being rendered, so this method can be used to move the camera, etc.
      Specified by:
      getCamera in interface CanvasRenderer
      Returns:
      the camera used by this canvas renderer
    • getScene

      public Scene getScene()
      Description copied from interface: CanvasRenderer
      Returns the scene being used by this canvas renderer.
      Specified by:
      getScene in interface CanvasRenderer
      Returns:
      the camera used by this canvas renderer
    • setScene

      public void setScene(Scene scene)
      Description copied from interface: CanvasRenderer
      Replaces the scene being used by this canvas renderer.
      Specified by:
      setScene in interface CanvasRenderer
      Parameters:
      scene - the scene to use
    • getRenderer

      public Renderer getRenderer()
      Description copied from interface: CanvasRenderer
      Returns the renderer being used by this canvas renderer.
      Specified by:
      getRenderer in interface CanvasRenderer
      Returns:
      the renderer used by this canvas renderer
    • setCamera

      public void setCamera(Camera camera)
      Description copied from interface: CanvasRenderer
      Replaces the camera being used by this canvas renderer.
      Specified by:
      setCamera in interface CanvasRenderer
      Parameters:
      camera - the camera to use
    • getRenderContext

      public JoglRenderContext getRenderContext()
      Specified by:
      getRenderContext in interface CanvasRenderer
      Returns:
      the Ardor3D RenderContext associated with this CanvasRenderer.
    • getFrameClear

      public int getFrameClear()
      Specified by:
      getFrameClear in interface CanvasRenderer
      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 interface CanvasRenderer
      Parameters:
      buffers - an int representing the buffers to clear at the start of each frame. Default is Renderer.BUFFER_COLOR_AND_DEPTH