org.jzy3d.plot3d.rendering.view
Class Renderer3d

java.lang.Object
  extended by org.jzy3d.plot3d.rendering.view.Renderer3d
All Implemented Interfaces:
EventListener, javax.media.opengl.GLEventListener

public class Renderer3d
extends Object
implements javax.media.opengl.GLEventListener

The Renderer3d object is a GLEventListener, that makes openGL calls necessary to initialize and render a Scene for an ICanvas. 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
protected  boolean debugGL
           
protected  boolean doScreenshotAtNextDisplay
           
protected  javax.media.opengl.glu.GLU glu
           
protected  int height
           
protected  BufferedImage image
           
protected  boolean traceGL
           
protected  View view
           
protected  int width
           
 
Constructor Summary
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
 void display(javax.media.opengl.GLAutoDrawable canvas)
          Called when the GLDrawable requires a rendering.
 void dispose(javax.media.opengl.GLAutoDrawable arg0)
           
 int getHeight()
          Return the height that was given after the last resize event.
 BufferedImage getLastScreenshot()
           
 int getWidth()
          Return the width that was given after the last resize event.
 void init(javax.media.opengl.GLAutoDrawable canvas)
          Called when the GLDrawable is rendered for the first time.
 void nextDisplayUpdateScreenshot()
           
 void reshape(javax.media.opengl.GLAutoDrawable canvas, int x, int y, int width, int height)
          Called when the GLDrawable is resized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

glu

protected javax.media.opengl.glu.GLU glu

view

protected View view

width

protected int width

height

protected int height

doScreenshotAtNextDisplay

protected boolean doScreenshotAtNextDisplay

image

protected BufferedImage image

traceGL

protected boolean traceGL

debugGL

protected boolean debugGL
Constructor Detail

Renderer3d

public Renderer3d(View view)
Initialize a Renderer attached to the given View.


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(javax.media.opengl.GLAutoDrawable canvas)
Called when the GLDrawable 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 interface javax.media.opengl.GLEventListener

display

public void display(javax.media.opengl.GLAutoDrawable canvas)
Called when the GLDrawable requires a rendering. All call to rendering methods should appear here.

Specified by:
display in interface javax.media.opengl.GLEventListener

reshape

public void reshape(javax.media.opengl.GLAutoDrawable canvas,
                    int x,
                    int y,
                    int width,
                    int height)
Called when the GLDrawable is resized.

Specified by:
reshape in interface javax.media.opengl.GLEventListener

dispose

public void dispose(javax.media.opengl.GLAutoDrawable arg0)
Specified by:
dispose in interface javax.media.opengl.GLEventListener

nextDisplayUpdateScreenshot

public void nextDisplayUpdateScreenshot()

getLastScreenshot

public BufferedImage getLastScreenshot()

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.