Package panamagl.canvas
Interface GLCanvas
public interface GLCanvas
A canvas able to perform OpenGL calls through the
GLEventListener interface.- Author:
- Martin Pernollet
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddPixelScaleListener(PixelScaleListener listener) Register a listener notified whengetPixelScale()changes.voiddisplay()Trigger display.Return the GL context.getFlip()getGL()Return the GL instance allowing to invoke OpenGL.Return the event listener handling init, drawing and resize requests.intReturn the performance information about this panel.default intHeight of the rendering surface (FBO) in physical pixels.default intWidth of the rendering surface (FBO) in physical pixels.default PixelScaleReturn the current pixel scale (ratio between physical pixels and logical pixels).Image<?> intgetWidth()default booleanWhether HiDPI rendering is enabled.booleanReturn true if the panel has initialized GL ressource and is ready for display.booleanReturn true if a frame rendering has started and not yet finished.booleanReturn true if the component is visible on screen (depend on windowing toolkit implementation, e.g.default voidremovePixelScaleListener(PixelScaleListener listener) Remove a previously registeredPixelScaleListener.voidrepaint()voidsetFlip(GLCanvas.Flip flip) voidsetGLEventListener(GLEventListener listener) Set the event listener handling init, drawing and resize requests.default voidsetHiDPIEnabled(boolean enabled) Toggle HiDPI rendering.voidsetOffscreenRenderer(OffscreenRenderer offscreen) voidsetScreenshot(Image<?> image)
-
Method Details
-
display
void display()Trigger display. The component is responsible for routing the request to the appropriate threads. -
isRendering
boolean isRendering()Return true if a frame rendering has started and not yet finished. -
getGLEventListener
GLEventListener getGLEventListener()Return the event listener handling init, drawing and resize requests. -
setGLEventListener
Set the event listener handling init, drawing and resize requests. -
isInitialized
boolean isInitialized()Return true if the panel has initialized GL ressource and is ready for display. -
isVisible
boolean isVisible()Return true if the component is visible on screen (depend on windowing toolkit implementation, e.g.Component.isVisible()). -
getContext
GLContext getContext()Return the GL context. -
getGL
GL getGL()Return the GL instance allowing to invoke OpenGL. -
getMonitoring
RenderCounter getMonitoring()Return the performance information about this panel. -
getWidth
int getWidth() -
getHeight
int getHeight() -
repaint
void repaint() -
setScreenshot
-
getScreenshot
Image<?> getScreenshot() -
getOffscreenRenderer
OffscreenRenderer getOffscreenRenderer() -
setOffscreenRenderer
-
setFlip
-
getFlip
GLCanvas.Flip getFlip() -
getPixelScale
Return the current pixel scale (ratio between physical pixels and logical pixels).Returns
PixelScale.IDENTITYfor canvases that have not been displayed yet, or for implementations that do not yet support HiDPI detection. -
getPhysicalWidth
default int getPhysicalWidth()Width of the rendering surface (FBO) in physical pixels.When HiDPI is enabled, this is
getWidth() * pixelScale.x(); otherwise it equalsgetWidth(). -
getPhysicalHeight
default int getPhysicalHeight()Height of the rendering surface (FBO) in physical pixels.- See Also:
-
addPixelScaleListener
Register a listener notified whengetPixelScale()changes.Default implementation is a no-op for canvases that do not yet support HiDPI events.
-
removePixelScaleListener
Remove a previously registeredPixelScaleListener. -
isHiDPIEnabled
default boolean isHiDPIEnabled()Whether HiDPI rendering is enabled.When
true(the default), the FBO is dimensioned in physical pixels — sharp rendering on Retina/HiDPI displays at the cost of more pixels to fill.When
false, the FBO is dimensioned in logical pixels — equivalent to setting a pixel scale of(1, 1): faster but the image is upscaled by the toolkit on HiDPI displays. Mirrors Jzy3D'sQuality.preserveViewportSize=true. -
setHiDPIEnabled
default void setHiDPIEnabled(boolean enabled) Toggle HiDPI rendering. @see #isHiDPIEnabled()
-