Package org.jzy3d.plot3d.rendering.view
Class Renderer3d
- java.lang.Object
-
- org.jzy3d.plot3d.rendering.view.Renderer3d
-
- All Implemented Interfaces:
com.jogamp.opengl.GLEventListener
,EventListener
- Direct Known Subclasses:
AWTRenderer3d
public class Renderer3d extends Object implements com.jogamp.opengl.GLEventListener
TheRenderer3d
is aGLEventListener
that handles init, display, reshape and screenshots of aScene
in aICanvas
. One can activate OpenGl errors in console by setting debugGL to true in the constructor. One can activate OpenGl feedback in console by setting traceGL to true in the constructor.- Author:
- Martin Pernollet
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
debugGL
protected boolean
doScreenshotAtNextDisplay
protected int
height
protected com.jogamp.opengl.util.texture.TextureData
image
protected double
lastRenderingTimeMs
protected TicToc
profileDisplayTimer
protected boolean
traceGL
protected View
view
protected int
width
-
Constructor Summary
Constructors Constructor Description Renderer3d()
Renderer3d(View view)
Initialize a Renderer attached to the given View.Renderer3d(View view, boolean traceGL, boolean debugGL)
Initialize a Renderer attached to the given View, and activate GL trace and errors to console.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
display(com.jogamp.opengl.GLAutoDrawable canvas)
Called when theGLAutoDrawable
requires a rendering.void
dispose(com.jogamp.opengl.GLAutoDrawable arg0)
int
getHeight()
Return the height that was given after the last resize event.double
getLastRenderingTimeMs()
com.jogamp.opengl.util.texture.TextureData
getLastScreenshot()
int
getWidth()
Return the width that was given after the last resize event.void
init(com.jogamp.opengl.GLAutoDrawable canvas)
Called when theGLAutoDrawable
is rendered for the first time.void
nextDisplayUpdateScreenshot()
SCREENSHOTSprotected void
renderScreenshotIfRequired(com.jogamp.opengl.GL gl)
void
reshape(com.jogamp.opengl.GLAutoDrawable canvas, int x, int y, int width, int height)
Called when theGLAutoDrawable
is resized.protected void
updatePainterWithGL(com.jogamp.opengl.GLAutoDrawable canvas)
This method allows configuring theIPainter
with the currentGL
context provided by theGLAutoDrawable
.
-
-
-
Field Detail
-
view
protected View view
-
width
protected int width
-
height
protected int height
-
doScreenshotAtNextDisplay
protected boolean doScreenshotAtNextDisplay
-
image
protected com.jogamp.opengl.util.texture.TextureData image
-
traceGL
protected boolean traceGL
-
debugGL
protected boolean debugGL
-
profileDisplayTimer
protected TicToc profileDisplayTimer
-
lastRenderingTimeMs
protected double lastRenderingTimeMs
-
-
Constructor Detail
-
Renderer3d
public Renderer3d(View view)
Initialize a Renderer attached to the given View.
-
Renderer3d
public Renderer3d()
-
Renderer3d
public Renderer3d(View view, boolean traceGL, boolean debugGL)
Initialize a Renderer attached to the given View, and activate GL trace and errors to console.
-
-
Method Detail
-
init
public void init(com.jogamp.opengl.GLAutoDrawable canvas)
Called when theGLAutoDrawable
is rendered for the first time. When one calls Scene.init() function, this function is called and makes the OpenGL buffers initialization. Note: in this implementation, GL Exceptions are not triggered. To do so, make te following call at the beginning of the init() body:canvas.setGL( new DebugGL(canvas.getGL()) );
- Specified by:
init
in interfacecom.jogamp.opengl.GLEventListener
-
display
public void display(com.jogamp.opengl.GLAutoDrawable canvas)
Called when theGLAutoDrawable
requires a rendering. All call to rendering methods should appear here.- Specified by:
display
in interfacecom.jogamp.opengl.GLEventListener
-
reshape
public void reshape(com.jogamp.opengl.GLAutoDrawable canvas, int x, int y, int width, int height)
Called when theGLAutoDrawable
is resized.- Specified by:
reshape
in interfacecom.jogamp.opengl.GLEventListener
-
updatePainterWithGL
protected void updatePainterWithGL(com.jogamp.opengl.GLAutoDrawable canvas)
This method allows configuring theIPainter
with the currentGL
context provided by theGLAutoDrawable
. This may be usefull to override in case of a mocking GL (to avoid having the mock replaced by a real GL Context).- Parameters:
canvas
-
-
dispose
public void dispose(com.jogamp.opengl.GLAutoDrawable arg0)
- Specified by:
dispose
in interfacecom.jogamp.opengl.GLEventListener
-
nextDisplayUpdateScreenshot
public void nextDisplayUpdateScreenshot()
SCREENSHOTS
-
getLastScreenshot
public com.jogamp.opengl.util.texture.TextureData getLastScreenshot()
-
renderScreenshotIfRequired
protected void renderScreenshotIfRequired(com.jogamp.opengl.GL gl)
-
getWidth
public int getWidth()
Return the width that was given after the last resize event.
-
getHeight
public int getHeight()
Return the height that was given after the last resize event.
-
getLastRenderingTimeMs
public double getLastRenderingTimeMs()
-
-