Class WorldWindowGLAutoDrawable

    • Field Detail

      • DEFAULT_VIEW_STOP_TIME

        public static final long DEFAULT_VIEW_STOP_TIME
        Default time in milliseconds that the view must remain unchanged before the View.VIEW_STOPPED message is sent.
        See Also:
        Constant Field Values
      • viewStopTime

        protected long viewStopTime
        Time in milliseconds that the view must remain unchanged before the View.VIEW_STOPPED message is sent.
      • lastViewID

        protected long lastViewID
        The most recent View modelView ID.
        See Also:
        View.getViewStateID()
      • viewRefreshTask

        protected java.util.concurrent.ScheduledFuture viewRefreshTask
        Schedule task to send the View.VIEW_STOPPED message after the view stop time elapses.
      • enableGpuCacheReinitialization

        protected boolean enableGpuCacheReinitialization
    • Constructor Detail

      • WorldWindowGLAutoDrawable

        public WorldWindowGLAutoDrawable()
        Construct a new WorldWindowGLCanvas for a specified GLDrawable.
    • Method Detail

      • getViewStopTime

        public long getViewStopTime()
        Indicates the amount of time, in milliseconds, that the View must remain unchanged before a View.VIEW_STOPPED event is triggered.
        Returns:
        Time in milliseconds that the View must must remain unchanged before the view stopped event is triggered.
      • setViewStopTime

        public void setViewStopTime​(long time)
        Specifies the amount of time, in milliseconds, that the View must remain unchanged before a View.VIEW_STOPPED event is triggered.
        Parameters:
        time - Time in milliseconds that the View must must remain unchanged before the view stopped event is triggered.
      • isEnableGpuCacheReinitialization

        public boolean isEnableGpuCacheReinitialization()
        Description copied from interface: WorldWindow
        Indicates whether the GPU resource cache is reinitialized when this window is reinitialized.
        Specified by:
        isEnableGpuCacheReinitialization in interface WorldWindow
        Returns:
        true if reinitialization is enabled, otherwise false.
      • setEnableGpuCacheReinitialization

        public void setEnableGpuCacheReinitialization​(boolean enableGpuCacheReinitialization)
        Description copied from interface: WorldWindow
        Specifies whether to reinitialize the GPU resource cache when this window is reinitialized. A value of true indicates that the GPU resource cache this window is using should be cleared when its init() method is called, typically when re-parented. Set this to false when this window is sharing context with other windows and is likely to be re-parented. It prevents the flashing caused by clearing and re-populating the GPU resource cache during re-parenting. The default value is true.
        Specified by:
        setEnableGpuCacheReinitialization in interface WorldWindow
        Parameters:
        enableGpuCacheReinitialization - true to enable reinitialization, otherwise false.
      • initializeCreditsController

        protected void initializeCreditsController()
      • shutdown

        public void shutdown()
        Description copied from class: WorldWindowImpl
        Causes resources used by the WorldWindow to be freed. The WorldWindow cannot be used once this method is called. An OpenGL context for the window must be current.
        Specified by:
        shutdown in interface WorldWindow
        Overrides:
        shutdown in class WorldWindowImpl
      • doShutdown

        protected void doShutdown()
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent propertyChangeEvent)
        Description copied from class: WWObjectImpl
        The property change listener for this instance. Receives property change notifications that this instance has registered with other property change notifiers.
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
        Overrides:
        propertyChange in class WWObjectImpl
        Parameters:
        propertyChangeEvent - the event
      • getContext

        public com.jogamp.opengl.GLContext getContext()
        Description copied from interface: WorldWindow
        Returns the GLContext associated with this WorldWindow.
        Specified by:
        getContext in interface WorldWindow
        Returns:
        the GLContext associated with this window. May be null.
      • isGLContextCompatible

        protected boolean isGLContextCompatible​(com.jogamp.opengl.GLContext context)
      • getRequiredOglFunctions

        protected java.lang.String[] getRequiredOglFunctions()
      • getRequiredOglExtensions

        protected java.lang.String[] getRequiredOglExtensions()
      • init

        public void init​(com.jogamp.opengl.GLAutoDrawable glAutoDrawable)
        See GLEventListener.init(GLAutoDrawable).
        Specified by:
        init in interface com.jogamp.opengl.GLEventListener
        Parameters:
        glAutoDrawable - the drawable
      • reinitialize

        protected void reinitialize​(com.jogamp.opengl.GLAutoDrawable glAutoDrawable)
      • dispose

        public void dispose​(com.jogamp.opengl.GLAutoDrawable glAutoDrawable)
        See GLEventListener.init(GLAutoDrawable).

        GLEventListener's dispose method indicates that the GL context has been released, and provides the listener an opportunity to clean up any resources. Dispose does not imply that the component's lifecycle has ended or that the application is closing. There are three cases in which dispose may be called:

        • The WorldWindow is removed from its parent component.
        • The WorldWindow's parent frame is closed.
        • The application calls either GLCanvas.dispose or GLJPanel.dispose.

        This implementation is left empty. In the case when a WorldWindow or a WorldWind application has reached its end of life, its resources should be released by calling WorldWindow.shutdown() or WorldWind.shutDown(), respectively. In the case when a WorldWindow is removed from its parent frame or that frame is closed without a call to shutdown, it is assumed that the application intends to reuse the WorldWindow. Resources associated with the previous GL context are released in the subsequent call to init.

        Specified by:
        dispose in interface com.jogamp.opengl.GLEventListener
        Parameters:
        glAutoDrawable - the drawable
      • display

        public void display​(com.jogamp.opengl.GLAutoDrawable glAutoDrawable)
        See GLEventListener.display(GLAutoDrawable).
        Specified by:
        display in interface com.jogamp.opengl.GLEventListener
        Parameters:
        glAutoDrawable - the drawable
        Throws:
        java.lang.IllegalStateException - if no SceneController exists for this canvas
      • checkForViewChange

        protected void checkForViewChange()
        Determine if the view has changed since the previous frame. If the view has changed, schedule a task that will send a View.VIEW_STOPPED to the Model if the view does not change for viewStopTime milliseconds.
        See Also:
        getViewStopTime()
      • doDisplay

        protected int doDisplay()
        Performs the actual repaint. Provided so that subclasses may override the repaint steps.
        Returns:
        if greater than zero, the window should be automatically repainted again at the indicated number of milliseconds from this method's return.
      • doSwapBuffers

        protected void doSwapBuffers​(com.jogamp.opengl.GLAutoDrawable drawable)
        Performs the actual buffer swap. Provided so that subclasses may override the swap steps.
        Parameters:
        drawable - the window's associated drawable.
      • reshape

        public void reshape​(com.jogamp.opengl.GLAutoDrawable glAutoDrawable,
                            int x,
                            int y,
                            int w,
                            int h)
        See GLEventListener.reshape(GLAutoDrawable, int, int, int, int).
        Specified by:
        reshape in interface com.jogamp.opengl.GLEventListener
        Parameters:
        glAutoDrawable - the drawable
      • redraw

        public void redraw()
        Description copied from interface: WorldWindow
        Causes a repaint event to be enqueued with the window system for this WorldWindow. The repaint will occur at the window system's discretion, within the window system toolkit's event loop, and on the thread of that loop. This is the preferred method for requesting a repaint of the WorldWindow.
        Specified by:
        redraw in interface WorldWindow
        Overrides:
        redraw in class WorldWindowImpl
      • redrawNow

        public void redrawNow()
        Description copied from interface: WorldWindow
        Immediately repaints the WorldWindow without waiting for a window system repaint event. This is not the preferred way to cause a repaint, but is provided for the rare cases that require it.
        Specified by:
        redrawNow in interface WorldWindow
        Overrides:
        redrawNow in class WorldWindowImpl
      • scheduleViewStopTask

        protected void scheduleViewStopTask​(long delay)
        Schedule a task that will send a View.VIEW_STOPPED message to the Model when the task executes. If the task runs (is not cancelled), then the view is considered stopped. Only one view stop task is scheduled at a time. If this method is called again before the task executes, the task will be cancelled and a new task scheduled.
        Parameters:
        delay - Delay in milliseconds until the task runs.
      • onMessage

        public void onMessage​(Message msg)
        Empty implementation of MessageListener.

        Forward the message event to the Model for distribution to the layers.

        Specified by:
        onMessage in interface MessageListener
        Overrides:
        onMessage in class WWObjectImpl
        Parameters:
        msg - Message event.