Class PanamaGLSwingCanvas

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, ICanvas, IPanamaGLCanvas, IScreenCanvas

public class PanamaGLSwingCanvas extends JPanel implements IPanamaGLCanvas
See Also:
  • Field Details

  • Constructor Details

    • PanamaGLSwingCanvas

      public PanamaGLSwingCanvas(IChartFactory factory, org.jzy3d.plot3d.rendering.scene.Scene scene, Quality quality, panamagl.canvas.GLCanvasSwing glCanvas)
  • Method Details

    • firePixelScaleChanged

      protected void firePixelScaleChanged(double pixelScaleX, double pixelScaleY)
    • getGLCanvas

      public panamagl.canvas.GLCanvas getGLCanvas()
      Specified by:
      getGLCanvas in interface IPanamaGLCanvas
    • getGLEventListener

      public panamagl.GLEventListener getGLEventListener()
      Specified by:
      getGLEventListener in interface IPanamaGLCanvas
    • setGLEventListener

      public void setGLEventListener(panamagl.GLEventListener listener)
      Specified by:
      setGLEventListener in interface IPanamaGLCanvas
    • isNative

      public boolean isNative()
      Specified by:
      isNative in interface ICanvas
    • getView

      public View getView()
      Specified by:
      getView in interface ICanvas
    • getRendererWidth

      public int getRendererWidth()
      Renderer dimensions are reported in physical pixels, matching the FBO size that the underlying GLCanvasSwing allocates. View uses these values to build the ViewportConfiguration that drives glViewport; on a Retina display the FBO is 2W x 2H so we must return 2W and 2H here, otherwise glViewport(0, 0, W, H) only fills the bottom-left quadrant of the FBO.

      When HiDPI is disabled (Jzy3D's Quality.preserveViewportSize=true), the FBO is already in logical pixels and getPhysicalWidth() returns getWidth().

      Specified by:
      getRendererWidth in interface ICanvas
    • getRendererHeight

      public int getRendererHeight()
      Specified by:
      getRendererHeight in interface ICanvas
    • screenshot

      public void screenshot(File file) throws IOException
      Specified by:
      screenshot in interface ICanvas
      Throws:
      IOException
    • screenshot

      public Object screenshot()
      Specified by:
      screenshot in interface ICanvas
    • display

      public void display()
      Specified by:
      display in interface IScreenCanvas
    • forceRepaint

      public void forceRepaint()
      Specified by:
      forceRepaint in interface ICanvas
    • dispose

      public void dispose()
      Specified by:
      dispose in interface ICanvas
    • addMouseController

      public void addMouseController(Object o)
      Specified by:
      addMouseController in interface ICanvas
    • addKeyController

      public void addKeyController(Object o)
      Specified by:
      addKeyController in interface ICanvas
    • removeMouseController

      public void removeMouseController(Object o)
      Specified by:
      removeMouseController in interface ICanvas
    • removeKeyController

      public void removeKeyController(Object o)
      Specified by:
      removeKeyController in interface ICanvas
    • getDebugInfo

      public String getDebugInfo()
      Specified by:
      getDebugInfo in interface ICanvas
    • setPixelScale

      public void setPixelScale(float[] scale)
      Map Jzy3D's JOGL-style setPixelScale to PanamaGL's setHiDPIEnabled: passing [1, 1] (a.k.a. Quality.preserveViewportSize=true) disables HiDPI so the FBO is dimensioned in logical pixels; any other value enables it.
      Specified by:
      setPixelScale in interface ICanvas
    • getPixelScale

      public org.jzy3d.maths.Coord2d getPixelScale()
      Specified by:
      getPixelScale in interface ICanvas
    • getPixelScaleJVM

      public org.jzy3d.maths.Coord2d getPixelScaleJVM()
      Specified by:
      getPixelScaleJVM in interface ICanvas
    • getLastRenderingTimeMs

      public double getLastRenderingTimeMs()
      Specified by:
      getLastRenderingTimeMs in interface ICanvas
    • addCanvasListener

      public void addCanvasListener(ICanvasListener listener)
      Specified by:
      addCanvasListener in interface ICanvas
    • removeCanvasListener

      public void removeCanvasListener(ICanvasListener listener)
      Specified by:
      removeCanvasListener in interface ICanvas
    • getCanvasListeners

      public List<ICanvasListener> getCanvasListeners()
      Specified by:
      getCanvasListeners in interface ICanvas
    • getAnimation

      public IAnimator getAnimation()
      Specified by:
      getAnimation in interface IScreenCanvas
    • getDimension

      public org.jzy3d.maths.Dimension getDimension()
      Specified by:
      getDimension in interface ICanvas