Class GLAutoDrawableDelegate

    • Constructor Detail

      • GLAutoDrawableDelegate

        public GLAutoDrawableDelegate​(GLDrawable drawable,
                                      GLContext context,
                                      Object upstreamWidget,
                                      boolean ownDevice,
                                      RecursiveLock lock)

        The GLContext can be assigned later manually via setContext(ctx) or it will be created lazily at the 1st display() method call.
        Lazy GLContext creation will take a shared GLContext into account which has been set directly or via another GLAutoDrawable.

        Parameters:
        drawable - a valid GLDrawable, may not be realized yet.
        context - a valid GLContext, may not have been made current (created) yet, may not be associated w/ drawable yet, may be null for lazy initialization at 1st display().
        upstreamWidget - optional UI element holding this instance, see getUpstreamWidget().
        ownDevice - pass true if AbstractGraphicsDevice.close() shall be issued, otherwise pass false. Closing the device is required in case the drawable is created w/ it's own new instance, e.g. offscreen drawables, and no further lifecycle handling is applied.
        lock - optional custom RecursiveLock.
    • Method Detail

      • windowRepaintOp

        public final void windowRepaintOp()
        Default implementation to handle repaint events from the windowing system
      • windowResizedOp

        public final void windowResizedOp​(int newWidth,
                                          int newHeight)
        Handling resize events from the windowing system.

        Implementation:

        • resizes the GLDrawable, if offscreen,
        • triggers a pending reshape events, and
        • issues a display() call, if no animator is present.

        All required locks are being claimed.

        Parameters:
        newWidth - new width in pixel units
        newWidth - new height in pixel units
      • getUpstreamWidget

        public final Object getUpstreamWidget()
        Description copied from interface: GLAutoDrawable
        Method may return the upstream UI toolkit object holding this GLAutoDrawable instance, if exist.

        Currently known Java UI toolkits and it's known return types are:

        Toolkit GLAutoDrawable Implementation ~ Return Type of getUpstreamWidget()
        NEWT GLWindow has a Window
        SWT GLCanvas is a Canvas
        AWT GLCanvas is a Canvas
        AWT GLJPanel is a JPanel
        However, the result may be other object types than the listed above due to new supported toolkits.

        This method may also return null if no UI toolkit is being used, as common for offscreen rendering.

        Specified by:
        getUpstreamWidget in interface GLAutoDrawable
      • setUpstreamWidget

        public final void setUpstreamWidget​(Object newUpstreamWidget)
        Set the upstream UI toolkit object.
        See Also:
        getUpstreamWidget()
      • destroy

        public final void destroy()
        Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext. If a window is attached to it's implementation, it shall be closed. Causes disposing of all OpenGL resources by calling dispose(..) for all registered GLEventListeners. Called automatically by the window system toolkit upon receiving a destroy notification. This routine may be called manually.

        This implementation calls GLAutoDrawableBase.defaultDestroy().

        User still needs to destroy the upstream window, which details are hidden from this aspect. This can be performed by overriding destroyImplInLock().

        Specified by:
        destroy in interface GLAutoDrawable
      • swapBuffers

        public final void swapBuffers()
                               throws GLException
        Description copied from interface: GLDrawable
        Swaps the front and back buffers of this drawable. For GLAutoDrawable implementations, when automatic buffer swapping is enabled (as is the default), this method is called automatically and should not be called by the end user.
        Specified by:
        swapBuffers in interface GLDrawable
        Throws:
        GLException
      • toString

        public String toString()
        Specified by:
        toString in interface GLDrawable
        Overrides:
        toString in class jogamp.opengl.GLAutoDrawableBase