Interface ILcdGLDrawable

All Known Subinterfaces:
ILcdGLExternalDrawable, ILcdGLOffScreenDrawable

public interface ILcdGLDrawable
Interface for an OpenGL context that applications can draw into. An ILcdGLDrawable is an application's main access point to OpenGL.
  • Method Details

    • addGLEventListener

      void addGLEventListener(ILcdGLEventListener aListener)
    • removeGLEventListener

      void removeGLEventListener(ILcdGLEventListener aListener)
    • getSize

      Dimension getSize()
      Returns the current size of the drawable.
      Returns:
      a Dimension
    • getViewportSize

      Dimension getViewportSize()
      Returns the size of the viewport (in pixels). Note that if DPI scaling is in effect, this size will be larger than the size reported by the UI component (AWT/Swing or JavaFX) that hosts this drawable. More specifically, the ratio between the viewport size and the size reported by the host component corresponds to the DPI scale factor.

      See ALspViewXYZWorldTransformation for more information about high DPI support in Lightspeed views.

      Returns:
      a Dimension representing the size of the viewport
      Since:
      2019.0
    • getGL

      ILcdGL getGL()
      Returns the ILcdGL object associated with the drawable. This object is the access point to the OpenGL API.
      Returns:
      an ILcdGL
    • setGL

      void setGL(ILcdGL aGL)
      Sets the ILcdGL used by this drawable. The default ILcdGL is implementation-specific and should be retained. This method should hence only be used to install utility wrappers around the ILcdGL, such as TLcdGLDebugGL.
      Parameters:
      aGL - an ILcdGL
    • getGLU

      ILcdGLU getGLU()
      Returns the ILcdGLU object associated with the drawable. This object is the access point to the GLU API.
      Returns:
      an ILcdGLU
    • setGLU

      void setGLU(ILcdGLU aGLU)
      Sets the ILcdGLU used by this drawable. The default ILcdGLU is implementation-specific and should be retained. This method should hence only be used to install utility wrappers around the ILcdGLU.
      Parameters:
      aGLU - an ILcdGLU
    • display

      void display()
      Causes OpenGL rendering to be performed for this drawable. This is done by making the OpenGL context current and then invoking all registered ILcdGLEventListeners. Note that this method is called automatically when the windowing system requires the drawable to be repainted, so there shouldn't normally be any need to call this method explicitly.
    • getGLInformation

      Properties getGLInformation()
      Returns a properties object containing information about the underlying OpenGL implementation that is being used. Initially this method may return an empty properties object. A properly filled properties object can only be accessed during and after the call the initialization of the ILcdGLDrawable. Other objects can be notified of this using the ILcdGLEventListener#init method. When filled, this properties object will contain the following properties.
      • gl.renderer: the name of the renderer. This name is typically specific to a particular configuration of a hardware platform.
      • gl.vendor: the company responsible for this GL implementation.
      • gl.version: the opengl implementation version number in the form version number<space>vendor-specific information.
      • gl.version.major: the major version number
      • gl.version.minor: the minor version number
      • gl.version.release: the release version number
      • gl.version.custom: vendor specific information
      • gl.extensions: a space separated list of supported OpenGL extensions.
      • glu.version: the GLU implementation version number in the form version number<space>vendor-specific information.
      • glu.version.major: the major version number
      • glu.version.minor: the minor version number
      • glu.version.release: the release version number
      • glu.version.custom: vendor specific information
      • glu.extensions: a space separated list of supported GLU extensions.
      • capabilities.red: the number of bits in use for the red channel of the color buffer.
      • capabilities.green: the number of bits in use for the green channel of the color buffer.
      • capabilities.blue: the number of bits in use for the blue channel of the color buffer.
      • capabilities.alpha: the number of bits in use for the alpha channel of the color buffer.
      • capabilities.depthbuffer: the bit precision of the depth buffer.
      • capabilities.maxtexturesize: a rough estimate of the largest texture that this implementation can handle.
      • capabilities.doublebuffer: 'true' if double buffering is being used, 'false' otherwise.
      • capabilities.stereographic: 'true' if sterographic rendering is supported by this implementation, 'false' otherwise.
      Returns:
      a properties object containing OpenGL information
    • isCurrent

      boolean isCurrent()
      Returns true if this drawable's OpenGL context is current. This means that it is possible to make OpenGL API calls from the current call site.
      Returns:
      true if this drawable's GL context is currently active
    • destroy

      void destroy()
      Disposes of this drawable. Attempting to use the drawable in any way after a call to this method may result in erroneous behaviour and/or exceptions.
    • getChosenGLCapabilities

      ILcdGLCapabilities getChosenGLCapabilities()
      Returns the ILcdGLCapabilities that were used to construct this drawable. These capabilities may be useful, for instance, to create a second drawable with the same framebuffer layout.
      Returns:
      a capabilities object describing this drawable
    • invokeLater

      void invokeLater(ILcdGLRunnable glRunnable)
      Schedules the given runnable to be invoked when the drawable's OpenGL context is current. This means it is permitted and safe for the runnable to perform OpenGL calls. If the context is not current when this method is invoked, the method returns immediately and the runnable will be invoked the next time the drawable is repainted.
      Parameters:
      glRunnable - the runnable to schedule
      Since:
      2013.0
    • invokeAndWait

      void invokeAndWait(ILcdGLRunnable glRunnable)
      Invokes the given runnable with the drawable's OpenGL context made current. This means it is permitted and safe for the runnable to perform OpenGL calls. If the context is not current when this method is invoked, it is made current. When this method returns, the runnable is therefore guaranteed to have been executed.
      Parameters:
      glRunnable - the runnable to execute
      Since:
      2013.0
    • isRealized

      default boolean isRealized()
      Indicates whether this drawable has effectively been initialized. Some implementations may create their OpenGL context lazily, for instance because it can only be done after a corresponding user interface component has been made visible on the screen for the first time.
      Returns:
      true if the OpenGL context for this drawable has effectively been realized
      Since:
      2018.1
    • getDPIScale

      default double getDPIScale()
      Returns the DPI scaling factor of this drawable. The DPI scale is the ratio between the OpenGL viewport width or height and the width or height of the drawable itself. When DPI scaling is enabled in the host operating system, the former will be larger than the latter. For instance, if the DPI scale is set to 150%, then this method will return 1.5 and getViewportSize() will be 50% wider and taller than getSize().

      See ALspViewXYZWorldTransformation for more information about DPI scaling in Lightspeed views.

      Note that calling this method before the drawable is fully realized may return an incorrect result.

      Returns:
      the DPI scale factor of this drawable