Class DrawContextImpl

    • Field Detail

      • frameTimestamp

        protected long frameTimestamp
      • glContext

        protected com.jogamp.opengl.GLContext glContext
      • glu

        protected com.jogamp.opengl.glu.GLU glu
      • view

        protected View view
      • model

        protected Model model
      • globe

        protected Globe globe
      • verticalExaggeration

        protected double verticalExaggeration
      • visibleSector

        protected Sector visibleSector
      • pickedObjects

        protected PickedObjectList pickedObjects
        The list of objects at the pick point during the most recent pick traversal. Initialized to an empty PickedObjectList.
      • objectsInPickRect

        protected PickedObjectList objectsInPickRect
        The list of objects intersecting the pick rectangle during the most recent pick traversal. Initialized to an empty PickedObjectList.
      • uniquePickNumber

        protected int uniquePickNumber
      • clearColor

        protected java.awt.Color clearColor
      • pixelColors

        protected java.nio.ByteBuffer pixelColors
        Buffer of RGB colors used to read back the framebuffer's colors and store them in client memory.
      • uniquePixelColors

        protected IntSet uniquePixelColors
        Set of ints used by getPickColorsInRectangle(java.awt.Rectangle, int[]) to identify the unique color codes in the specified rectangle. This consolidates duplicate colors to a single entry. We use IntSet to achieve constant time insertion, and to reduce overhead associated associated with storing integer primitives in a HashSet.
      • pickingMode

        protected boolean pickingMode
      • deepPickingMode

        protected boolean deepPickingMode
      • pickPoint

        protected java.awt.Point pickPoint
        Indicates the current pick point in AWT screen coordinates, or null to indicate that there is no pick point. Initially null.
      • pickRect

        protected java.awt.Rectangle pickRect
        Indicates the current pick rectangle in AWT screen coordinates, or null to indicate that there is no pick rectangle. Initially null.
      • isOrderedRenderingMode

        protected boolean isOrderedRenderingMode
      • preRenderMode

        protected boolean preRenderMode
      • viewportCenterScreenPoint

        protected java.awt.Point viewportCenterScreenPoint
      • viewportCenterPosition

        protected Position viewportCenterPosition
      • perFrameStatisticsKeys

        protected java.util.Set<java.lang.String> perFrameStatisticsKeys
      • currentLayer

        protected Layer currentLayer
      • redrawRequested

        protected int redrawRequested
      • renderingExceptions

        protected java.util.Collection<java.lang.Throwable> renderingExceptions
      • pickPointFrustumDimension

        protected java.awt.Dimension pickPointFrustumDimension
      • orderedSurfaceRenderables

        protected java.util.Queue<OrderedRenderable> orderedSurfaceRenderables
      • credits

        protected java.util.LinkedHashMap<ScreenCredit,​java.lang.Long> credits
      • DEFAULT_DEPTH_OFFSET_FACTOR

        public static final float DEFAULT_DEPTH_OFFSET_FACTOR
        See Also:
        Constant Field Values
      • DEFAULT_DEPTH_OFFSET_UNITS

        public static final float DEFAULT_DEPTH_OFFSET_UNITS
        See Also:
        Constant Field Values
      • terrain

        protected Terrain terrain
    • Constructor Detail

      • DrawContextImpl

        public DrawContextImpl()
    • Method Detail

      • dispose

        public void dispose()
        Free internal resources held by this draw context. A GL context must be current when this method is called.
        Specified by:
        dispose in interface Disposable
        Throws:
        com.jogamp.opengl.GLException - - If an OpenGL context is not current when this method is called.
      • getGL

        public final com.jogamp.opengl.GL getGL()
        Description copied from interface: DrawContext
        Retrieves the current com.jogamp.opengl.GL. A GL or GLU is required for all graphical rendering in WorldWind.
        Specified by:
        getGL in interface DrawContext
        Returns:
        the current GL if available, null otherwise
      • getGLU

        public final com.jogamp.opengl.glu.GLU getGLU()
        Description copied from interface: DrawContext
        Retrieves the current com.jogamp.opengl.glu.GLU. A GLU or GL is required for all graphical rendering in WorldWind.
        Specified by:
        getGLU in interface DrawContext
        Returns:
        the current GLU if available, null otherwise
      • getGLContext

        public final com.jogamp.opengl.GLContext getGLContext()
        Description copied from interface: DrawContext
        Retrieves this DrawContexts com.jogamp.opengl.GLContext. If this method returns null, then there are potentially no active GLContexts and rendering should be aborted.
        Specified by:
        getGLContext in interface DrawContext
        Returns:
        this DrawContexts com.jogamp.opengl.GLContext.
      • getDrawableHeight

        public final int getDrawableHeight()
        Description copied from interface: DrawContext
        Indicates the height in pixels of the drawing target associated with this DrawContext. The returned height is potentially different from the GL viewport height. If this DrawContext is associated with a GLJPanel, the returned height is the power-of-two ceiling of the viewport, and is therefore almost always larger than the GL viewport height.

        The GL viewport dimensions can be accessed by calling getView().getViewport() on this DrawContext.

        Specified by:
        getDrawableHeight in interface DrawContext
        Returns:
        the height of the drawing target associated with this DrawContext, in pixels.
      • getDrawableWidth

        public final int getDrawableWidth()
        Description copied from interface: DrawContext
        Indicates the width in pixels of the drawing target associated with this DrawContext. The returned width is potentially different from the GL viewport width. If this DrawContext is associated with a GLJPanel, the returned width is the power-of-two ceiling of the viewport, and is therefore almost always larger than the GL viewport width.

        The GL viewport dimensions can be accessed by calling getView().getViewport() on this DrawContext.

        Specified by:
        getDrawableWidth in interface DrawContext
        Returns:
        the width of the drawing target associated with this DrawContext, in pixels.
      • getGLDrawable

        public final com.jogamp.opengl.GLDrawable getGLDrawable()
        Description copied from interface: DrawContext
        Retrieves the current com.jogamp.opengl.GLDrawable. A GLDrawable can be used to create a GLContext, which can then be used for rendering.
        Specified by:
        getGLDrawable in interface DrawContext
        Returns:
        the current GLDrawable, null if none available
      • initialize

        public final void initialize​(com.jogamp.opengl.GLContext glContext)
        Description copied from interface: DrawContext
        Initializes this DrawContext. This method should be called at the beginning of each frame to prepare the DrawContext for the coming render pass.
        Specified by:
        initialize in interface DrawContext
        Parameters:
        glContext - the com.jogamp.opengl.GLContext to use for this render pass
      • setModel

        public final void setModel​(Model model)
        Description copied from interface: DrawContext
        Assign a new Model. Some layers cannot function properly with a null Model. It is recommended that the Model is never set to null during a normal render pass.
        Specified by:
        setModel in interface DrawContext
        Parameters:
        model - the new Model
      • getModel

        public final Model getModel()
        Description copied from interface: DrawContext
        Retrieves the current Model, which may be null.
        Specified by:
        getModel in interface DrawContext
        Returns:
        the current Model, which may be null
      • getLayers

        public final LayerList getLayers()
        Description copied from interface: DrawContext
        Retrieves a list containing all the current layers. No guarantee is made about the order of the layers.
        Specified by:
        getLayers in interface DrawContext
        Returns:
        a LayerList containing all the current layers
      • getVisibleSector

        public final Sector getVisibleSector()
        Description copied from interface: DrawContext
        Retrieves a Sector which is at least as large as the current visible sector. The value returned is the value passed to SetVisibleSector. This method may return null.
        Specified by:
        getVisibleSector in interface DrawContext
        Returns:
        a Sector at least the size of the current visible sector, null if unavailable
      • setVisibleSector

        public final void setVisibleSector​(Sector s)
        Description copied from interface: DrawContext
        Sets the visible Sector. The new visible sector must completely encompass the Sector which is visible on the display.
        Specified by:
        setVisibleSector in interface DrawContext
        Parameters:
        s - the new visible Sector
      • setSurfaceGeometry

        public void setSurfaceGeometry​(SectorGeometryList surfaceGeometry)
        Description copied from interface: DrawContext
        Specifies the current surface geometry.
        Specified by:
        setSurfaceGeometry in interface DrawContext
        Parameters:
        surfaceGeometry - the surface geometry to make current. May be null, indicating no surface geometry.
      • getSurfaceGeometry

        public SectorGeometryList getSurfaceGeometry()
        Description copied from interface: DrawContext
        Retrieves a list of all the sectors rendered so far this frame.
        Specified by:
        getSurfaceGeometry in interface DrawContext
        Returns:
        a SectorGeometryList containing every SectorGeometry rendered so far this render pass.
      • getGlobe

        public final Globe getGlobe()
        Description copied from interface: DrawContext
        Retrieves the current Globe, which may be null.
        Specified by:
        getGlobe in interface DrawContext
        Returns:
        the current Globe, which may be null
      • setView

        public final void setView​(View view)
        Description copied from interface: DrawContext
        Assigns a new View. Some layers cannot function properly with a null View. It is recommended that the View is never set to null during a normal render pass.
        Specified by:
        setView in interface DrawContext
        Parameters:
        view - the enw View
      • getView

        public final View getView()
        Description copied from interface: DrawContext
        Retrieves the current View, which may be null.
        Specified by:
        getView in interface DrawContext
        Returns:
        the current View, which may be null
      • setGLContext

        public final void setGLContext​(com.jogamp.opengl.GLContext glContext)
        Description copied from interface: DrawContext
        Assigns this DrawContext a new com.jogamp.opengl.GLContext. May throw a NullPointerException if glContext is null.
        Specified by:
        setGLContext in interface DrawContext
        Parameters:
        glContext - the new com.jogamp.opengl.GLContext
      • getVerticalExaggeration

        public final double getVerticalExaggeration()
        Description copied from interface: DrawContext
        Retrieves the current vertical exaggeration. Vertical exaggeration affects the appearance of areas with varied elevation. A vertical exaggeration of zero creates a surface which exactly fits the shape of the underlying Globe. A vertical exaggeration of 3 will create mountains and valleys which are three times as high/deep as they really are.
        Specified by:
        getVerticalExaggeration in interface DrawContext
        Returns:
        the current vertical exaggeration
      • setVerticalExaggeration

        public final void setVerticalExaggeration​(double verticalExaggeration)
        Description copied from interface: DrawContext
        Sets the vertical exaggeration. Vertical exaggeration affects the appearance of areas with varied elevation. A vertical exaggeration of zero creates a surface which exactly fits the shape of the underlying Globe. A vertical exaggeration of 3 will create mountains and valleys which are three times as high/deep as they really are.
        Specified by:
        setVerticalExaggeration in interface DrawContext
        Parameters:
        verticalExaggeration - the new vertical exaggeration.
      • getGpuResourceCache

        public GpuResourceCache getGpuResourceCache()
        Description copied from interface: DrawContext
        Returns the GPU resource cache used by this draw context.
        Specified by:
        getGpuResourceCache in interface DrawContext
        Returns:
        the GPU resource cache used by this draw context.
      • setGpuResourceCache

        public void setGpuResourceCache​(GpuResourceCache gpuResourceCache)
        Description copied from interface: DrawContext
        Specifies the GPU resource cache for this draw context.
        Specified by:
        setGpuResourceCache in interface DrawContext
        Parameters:
        gpuResourceCache - the GPU resource cache for this draw context.
      • setTextRendererCache

        public void setTextRendererCache​(TextRendererCache textRendererCache)
        Description copied from interface: DrawContext
        Specifies this context's text renderer cache.
        Specified by:
        setTextRendererCache in interface DrawContext
        Parameters:
        textRendererCache - the context's text renderer cache.
      • setAnnotationRenderer

        public void setAnnotationRenderer​(AnnotationRenderer ar)
        Description copied from interface: DrawContext
        Since Annotations are Renderables, they can be exist outside an AnnotationLayer, in which case they are responsible for rendering themselves. The draw context's annotation renderer provides an active renderer for that purpose.
        Specified by:
        setAnnotationRenderer in interface DrawContext
        Parameters:
        ar - the new annotation renderer for the draw context.
      • getStandardLightingModel

        public LightingModel getStandardLightingModel()
        Description copied from interface: DrawContext
        Returns the current model used for standard lighting.
        Specified by:
        getStandardLightingModel in interface DrawContext
        Returns:
        the current standard lighting model, or null if no model is defined.
      • setStandardLightingModel

        public void setStandardLightingModel​(LightingModel standardLighting)
        Description copied from interface: DrawContext
        Specifies the lighting model used for standard lighting.
        Specified by:
        setStandardLightingModel in interface DrawContext
        Parameters:
        standardLighting - the lighting model to use for standard lighting, or null to disable standard lighting.
      • setPickPoint

        public void setPickPoint​(java.awt.Point pickPoint)
        Description copied from interface: DrawContext
        Specifies the current pick point in AWT screen coordinates, or null to indicate that there is no pick point. During each pick traversal, layers determine if their contents are drawn at the pick point. If so, layers add each unique picked object to a PickedObjectList on this draw context by calling DrawContext.addPickedObject(gov.nasa.worldwind.pick.PickedObject). This list can be accessed by calling DrawContext.getPickedObjects().

        If the pick point is null, the pick point is ignored during each pick traversal, and the list of objects returned by getPickedObjects is empty.

        Specified by:
        setPickPoint in interface DrawContext
        Parameters:
        pickPoint - the current pick point, or null to specify that there is no pick point.
      • setPickRectangle

        public void setPickRectangle​(java.awt.Rectangle pickRect)
        Description copied from interface: DrawContext
        Specifies the current pick rectangle in AWT screen coordinates, or null to indicate that there is no pick rectangle. During each pick traversal, layers determine if their contents intersect the pick rectangle. If so, layers add each unique picked object to a PickedObjectList on this draw context by calling DrawContext.addObjectInPickRectangle(gov.nasa.worldwind.pick.PickedObject). This is list can be accessed by calling DrawContext.getObjectsInPickRectangle().

        If the pick rectangle is null, the pick rectangle is ignored during each pick traversal, and the list of objects returned by getObjectsInPickRectangle is empty.

        Specified by:
        setPickRectangle in interface DrawContext
        Parameters:
        pickRect - the current pick rectangle, or null to specify that there is no pick rectangle.
      • getViewportCenterScreenPoint

        public java.awt.Point getViewportCenterScreenPoint()
        Description copied from interface: DrawContext
        Indicates the screen-coordinate point of the current viewport's center.
        Specified by:
        getViewportCenterScreenPoint in interface DrawContext
        Returns:
        the screen-coordinate point of the current viewport's center.
      • setViewportCenterScreenPoint

        public void setViewportCenterScreenPoint​(java.awt.Point viewportCenterScreenPoint)
        Description copied from interface: DrawContext
        Specifies the screen-coordinate point of the current viewport's center.
        Specified by:
        setViewportCenterScreenPoint in interface DrawContext
        Parameters:
        viewportCenterScreenPoint - the screen-coordinate point of the current viewport's center.
      • getViewportCenterPosition

        public Position getViewportCenterPosition()
        Description copied from interface: DrawContext
        Indicates the geographic coordinates of the point on the terrain at the current viewport's center.
        Specified by:
        getViewportCenterPosition in interface DrawContext
        Returns:
        the geographic coordinates of the current viewport's center. Returns null if the globe's surface is not under the viewport's center point.
      • setViewportCenterPosition

        public void setViewportCenterPosition​(Position viewportCenterPosition)
        Description copied from interface: DrawContext
        Specifies the geographic coordinates of the point on the terrain at the current viewport's center.
        Specified by:
        setViewportCenterPosition in interface DrawContext
        Parameters:
        viewportCenterPosition - the geographic coordinates of the current viewport's center. May be null.
      • getPickedObjects

        public PickedObjectList getPickedObjects()
        Description copied from interface: DrawContext
        Returns the list of objects at the pick point during the most recent pick traversal. The returned list is empty if nothing is at the pick point, or if the pick point is null.
        Specified by:
        getPickedObjects in interface DrawContext
        Returns:
        the list of picked objects.
      • getObjectsInPickRectangle

        public PickedObjectList getObjectsInPickRectangle()
        Description copied from interface: DrawContext
        Returns the list of objects intersecting the pick rectangle during the most recent pick traversal. The returned list is empty if nothing intersects the pick rectangle, or if the pick rectangle is null.
        Specified by:
        getObjectsInPickRectangle in interface DrawContext
        Returns:
        the list of picked objects.
      • getUniquePickColor

        public java.awt.Color getUniquePickColor()
        Description copied from interface: DrawContext
        Returns a unique color to serve as a pick identifier during picking. This allocates a single unique color from the pick color address space and returns that color. The color's RGB components represent an address to the pick color code.
        Specified by:
        getUniquePickColor in interface DrawContext
        Returns:
        a unique pick color.
      • getUniquePickColorRange

        public java.awt.Color getUniquePickColorRange​(int count)
        Description copied from interface: DrawContext
        Returns a range of unique colors to serve as pick identifiers during picking. This allocates count unique colors from the pick color address space and returns the first color in the range. The first color's RGB components represent an address to the beginning of a sequential range of pick color codes. This method is similar to calling the no-argument DrawContext.getUniquePickColor() count times, but guarantees a contiguous range of color codes and is more efficient when count is large.

        The number of pick colors is limited to a finite address space. This method returns null when there are fewer than count remaining unique colors in the pick color address space, or when count is less than 1.

        Specified by:
        getUniquePickColorRange in interface DrawContext
        Parameters:
        count - the number of unique colors to allocate.
        Returns:
        the first unique pick color if there are sufficient unique colors remaining and count is greater than 0, otherwise null.
      • getClearColor

        public java.awt.Color getClearColor()
        Description copied from interface: DrawContext
        Returns the WorldWindow's background color.
        Specified by:
        getClearColor in interface DrawContext
        Returns:
        the WorldWindow's background color.
      • getPickColorAtPoint

        public int getPickColorAtPoint​(java.awt.Point point)
        Returns the framebuffer RGB color for a point in AWT screen coordinates, formatted as a pick color code. The red, green, and blue components are each stored as an 8-bit unsigned integer, and packed into bits 0-23 of the returned integer as follows: bits 16-23 are red, bits 8-15 are green, and bits 0-7 are blue. This format is consistent with the RGB integers used to create the pick colors in getUniquePickColor.

        This returns 0 if the point contains the clear color, or is outside this draw context's drawable area.

        Specified by:
        getPickColorAtPoint in interface DrawContext
        Parameters:
        point - the point to return a color for, in AWT screen coordinates.
        Returns:
        the RGB color corresponding to the specified point.
      • getPickColorsInRectangle

        public int[] getPickColorsInRectangle​(java.awt.Rectangle rectangle,
                                              int[] minAndMaxColorCodes)
        Returns an array of the unique framebuffer RGB colors within a rectangle in AWT screen coordinates, formatted as pick color codes. The red, green, and blue components are each stored as an 8-bit unsigned integer, and packed into bits 0-23 of the returned integers as follows: bits 16-23 are red, bits 8-15 are green, and bits 0-7 are blue. This format is consistent with the RGB integers used to create the pick colors in getUniquePickColor.

        The returned array contains one entry for each unique color. Points in the rectangle that contain the clear color or are outside this draw context's drawable area are ignored. This returns null if the specified rectangle is empty, or contains only the clear color.

        The minAndMaxColorCodes parameter limits the unique colors that this method returns to the specified range. The minimum color must be stored in array index 0, and the maximum color must be stored in array index 1. These values can be used to specify a small range of colors relative to the framebuffer contents, effectively culling the colors that must be considered by this method and the caller. When specified, these integers must be formatted exactly as the integers this method returns.

        Specified by:
        getPickColorsInRectangle in interface DrawContext
        Parameters:
        rectangle - the rectangle to return unique colors for, in AWT screen coordinates.
        minAndMaxColorCodes - an two element array representing the minimum and maximum RGB colors to return. May be null to specify that all color codes must be returned.
        Returns:
        the unique RGB colors corresponding to the specified rectangle, or null if the rectangle is empty or the rectangle contains only the clear color.
      • isPickingMode

        public boolean isPickingMode()
        Description copied from interface: DrawContext
        Indicates whether the scene controller is currently picking.
        Specified by:
        isPickingMode in interface DrawContext
        Returns:
        true if the scene controller is picking, otherwise false
      • enablePickingMode

        public void enablePickingMode()
        Description copied from interface: DrawContext
        Specifies that the scene controller is beginning its pick traversal.
        Specified by:
        enablePickingMode in interface DrawContext
      • disablePickingMode

        public void disablePickingMode()
        Description copied from interface: DrawContext
        Specifies that the scene controller has ended its pick traversal.
        Specified by:
        disablePickingMode in interface DrawContext
      • isDeepPickingEnabled

        public boolean isDeepPickingEnabled()
        Description copied from interface: DrawContext
        Indicates whether all items under cursor are picked.
        Specified by:
        isDeepPickingEnabled in interface DrawContext
        Returns:
        true if all items under the cursor are picked, otherwise false
      • setDeepPickingEnabled

        public void setDeepPickingEnabled​(boolean tf)
        Description copied from interface: DrawContext
        Specifies whether all items under the cursor are picked.
        Specified by:
        setDeepPickingEnabled in interface DrawContext
        Parameters:
        tf - true to pick all objects under the cursor
      • isPreRenderMode

        public boolean isPreRenderMode()
        Description copied from interface: DrawContext
        Indicates whether the scene controller is currently pre-rendering.
        Specified by:
        isPreRenderMode in interface DrawContext
        Returns:
        true if pre-rendering, otherwise false.
        See Also:
        PreRenderable
      • setPreRenderMode

        public void setPreRenderMode​(boolean preRenderMode)
        Description copied from interface: DrawContext
        Specifies whether the scene controller is pre-rendering.
        Specified by:
        setPreRenderMode in interface DrawContext
        Parameters:
        preRenderMode - true to indicate pre-rendering, otherwise false.
        See Also:
        PreRenderable
      • addOrderedRenderable

        public void addOrderedRenderable​(OrderedRenderable orderedRenderable,
                                         boolean isBehind)
        Adds an OrderedRenderable to the draw context's ordered renderable list, optionally indicating that the draw context should treat the specified ordered renderable as behind other ordered renderables. If isBehind is true, the draw context treats the specified ordered renderable as though it is behind all other ordered renderables and ignores the ordered renderable's eye distance. If multiple ordered renderables are added with isBehind specified as true, those ordered renderables are drawn according to the order in which they are added.
        Specified by:
        addOrderedRenderable in interface DrawContext
        Parameters:
        orderedRenderable - the ordered renderable to add.
        isBehind - true to specify that the ordered renderable is behind all other ordered renderables, or false to interpret the ordered renderable according to its eye distance.
      • peekOrderedRenderables

        public OrderedRenderable peekOrderedRenderables()
        Description copied from interface: DrawContext
        Returns the next OrderedRenderable on the ordered-renderable priority queue but does not remove it from the queue.
        Specified by:
        peekOrderedRenderables in interface DrawContext
        Returns:
        the next ordered renderable, or null if there are no more ordered renderables on the queue.
      • pollOrderedRenderables

        public OrderedRenderable pollOrderedRenderables()
        Description copied from interface: DrawContext
        Returns the next OrderedRenderable on the ordered-renderable priority queue and removes it from the queue.
        Specified by:
        pollOrderedRenderables in interface DrawContext
        Returns:
        the next ordered renderable, or null if there are no more ordered renderables on the queue.
      • setClutterFilter

        public void setClutterFilter​(ClutterFilter filter)
        Description copied from interface: DrawContext
        Specifies the clutter filter to use. May be null to indicate no decluttering.
        Specified by:
        setClutterFilter in interface DrawContext
        Parameters:
        filter - the clutter filter.
      • applyClutterFilter

        public void applyClutterFilter()
        Description copied from interface: DrawContext
        Filter overlapping text from the ordered renderable list.
        Specified by:
        applyClutterFilter in interface DrawContext
      • addOrderedSurfaceRenderable

        public void addOrderedSurfaceRenderable​(OrderedRenderable orderedRenderable)
        Adds an OrderedRenderable to the draw context's ordered surface renderable queue. This queue is populated during layer rendering with objects to render on the terrain surface, and is processed immediately after layer rendering.
        Specified by:
        addOrderedSurfaceRenderable in interface DrawContext
        Parameters:
        orderedRenderable - the ordered renderable to add.
      • getOrderedSurfaceRenderables

        public java.util.Queue<OrderedRenderable> getOrderedSurfaceRenderables()
        Returns the draw context's ordered surface renderable queue. This queue is populated during layer rendering with objects to render on the terrain surface, and is processed immediately after layer rendering.
        Specified by:
        getOrderedSurfaceRenderables in interface DrawContext
        Returns:
        the draw context's ordered surface renderable queue.
      • drawUnitQuad

        public void drawUnitQuad()
        Description copied from interface: DrawContext
        Draws a quadrilateral using the current OpenGL state. The quadrilateral points are (0, 0), (1, 0), (1, 1), (0, 1).
        Specified by:
        drawUnitQuad in interface DrawContext
      • drawUnitQuad

        public void drawUnitQuad​(com.jogamp.opengl.util.texture.TextureCoords texCoords)
        Description copied from interface: DrawContext
        Draws a quadrilateral using the current OpenGL state and specified texture coordinates. The quadrilateral points are (0, 0), (1, 0), (1, 1), (0, 1).
        Specified by:
        drawUnitQuad in interface DrawContext
        Parameters:
        texCoords - texture coordinates to assign to each quadrilateral vertex.
      • drawUnitQuadOutline

        public void drawUnitQuadOutline()
        Description copied from interface: DrawContext
        Draws a quadrilateral outline using the current OpenGL state. The quadrilateral points are (0, 0), (1, 0), (1, 1), (0, 1).
        Specified by:
        drawUnitQuadOutline in interface DrawContext
      • drawNormals

        public void drawNormals​(float length,
                                java.nio.FloatBuffer vBuf,
                                java.nio.FloatBuffer nBuf)
        Description copied from interface: DrawContext
        This is a diagnostic method to display normal vectors.
        Specified by:
        drawNormals in interface DrawContext
        Parameters:
        length - the length to draw the vectors, in meters.
        vBuf - a vertex buffer. If null, no vectors are drawn.
        nBuf - a buffer of normal vectors corresponding to the vertex buffer. If null, no vectors are drawn.
      • getPointOnTerrain

        public Vec4 getPointOnTerrain​(Angle latitude,
                                      Angle longitude)
        Description copied from interface: DrawContext
        Computes a location's Cartesian point on the currently visible terrain.
        Specified by:
        getPointOnTerrain in interface DrawContext
        Parameters:
        latitude - the location's latitude.
        longitude - the location's longitude.
        Returns:
        the location's corresponding Cartesian point, or null if the location is not currently visible.
      • getPerFrameStatistics

        public java.util.Collection<PerformanceStatistic> getPerFrameStatistics()
        Description copied from interface: DrawContext
        Returns the performance statistics that are gathered during each frame.
        Specified by:
        getPerFrameStatistics in interface DrawContext
        Returns:
        the performance statistics that are gathered during each frame.
      • setPerFrameStatisticsKeys

        public void setPerFrameStatisticsKeys​(java.util.Set<java.lang.String> statKeys,
                                              java.util.Collection<PerformanceStatistic> stats)
        Description copied from interface: DrawContext
        Specifies the performance statistics that are monitored during each frame. Both arguments to this method may be null. If either is null then statistics are not gathered.
        Specified by:
        setPerFrameStatisticsKeys in interface DrawContext
        Parameters:
        statKeys - the keys identifying the statistics to monitor.
        stats - a list in which the statistics are placed as they're monitored.
      • getPerFrameStatisticsKeys

        public java.util.Set<java.lang.String> getPerFrameStatisticsKeys()
        Description copied from interface: DrawContext
        Indicates the statistics that are monitored for each frame.
        Specified by:
        getPerFrameStatisticsKeys in interface DrawContext
        Returns:
        the keys of the statistics monitored for each frame.
      • setPerFrameStatistic

        public void setPerFrameStatistic​(java.lang.String key,
                                         java.lang.String displayName,
                                         java.lang.Object value)
        Description copied from interface: DrawContext
        Specifies a performance statistic that's assigned for each frame. Use this method to update the value of a specific statistic.
        Specified by:
        setPerFrameStatistic in interface DrawContext
        Parameters:
        key - the key identifying the statistic to monitor.
        displayName - the name to use when displaying this statistic.
        value - the statistic's value. May be null.
        See Also:
        DrawContext.setPerFrameStatistics(java.util.Collection)
      • getFrameTimeStamp

        public long getFrameTimeStamp()
        Description copied from interface: DrawContext
        Returns the time stamp corresponding to the beginning of a pre-render, pick, render sequence. The stamp remains constant across these three operations so that called objects may avoid recomputing the same values during each of the calls in the sequence.
        Specified by:
        getFrameTimeStamp in interface DrawContext
        Returns:
        the frame time stamp. See System.currentTimeMillis() for its numerical meaning.
      • setFrameTimeStamp

        public void setFrameTimeStamp​(long frameTimeStamp)
        Description copied from interface: DrawContext
        Specifies the time stamp corresponding to the beginning of a pre-render, pick, render sequence. The stamp must remain constant across these three operations so that called objects may avoid recomputing the same values during each of the calls in the sequence.
        Specified by:
        setFrameTimeStamp in interface DrawContext
        Parameters:
        frameTimeStamp - the frame time stamp. See System.currentTimeMillis() for its numerical meaning.
      • getVisibleSectors

        public java.util.List<Sector> getVisibleSectors​(double[] resolutions,
                                                        long timeLimit,
                                                        Sector sector)
        Description copied from interface: DrawContext
        Returns the visible sectors at one of several specified resolutions within a specified search sector. Several sectors resolutions may be specified along with a time limit. The best resolution that can be determined within the time limit is returned.

        Adherence to the time limit is not precise. The limit is checked only between full searches at each resolution. The search may take more than the specified time, but will terminate if no time is left before starting a higher-resolution search.

        Specified by:
        getVisibleSectors in interface DrawContext
        Parameters:
        resolutions - the resolutions of the sectors to return, in latitude.
        timeLimit - the amount of time, in milliseconds, to allow for searching.
        sector - the sector to decompose into visible sectors.
        Returns:
        the visible sectors at the best resolution achievable given the time limit. The actual resolution can be determined by examining the delta-latitude value of any of the returned sectors.
      • setCurrentLayer

        public void setCurrentLayer​(Layer layer)
        Description copied from interface: DrawContext
        Sets the current-layer field to the specified layer or null. The field is informative only and enables layer contents to determine their containing layer.
        Specified by:
        setCurrentLayer in interface DrawContext
        Parameters:
        layer - the current layer or null.
      • getCurrentLayer

        public Layer getCurrentLayer()
        Description copied from interface: DrawContext
        Returns the current-layer. The field is informative only and enables layer contents to determine their containing layer.
        Specified by:
        getCurrentLayer in interface DrawContext
        Returns:
        the current layer, or null if no layer is current.
      • addScreenCredit

        public void addScreenCredit​(ScreenCredit credit)
        Description copied from interface: DrawContext
        Adds a screen-credit icon to display.
        Specified by:
        addScreenCredit in interface DrawContext
        Parameters:
        credit - the screen credit to display.
      • getScreenCredits

        public java.util.Map<ScreenCredit,​java.lang.Long> getScreenCredits()
        Description copied from interface: DrawContext
        Returns the screen credits currently held and displayed by this draw context.
        Specified by:
        getScreenCredits in interface DrawContext
        Returns:
        the screen credits currently held by this draw context.
      • getRedrawRequested

        public int getRedrawRequested()
        Description copied from interface: DrawContext
        Indicates whether a new frame should be generated by the SceneController.
        Specified by:
        getRedrawRequested in interface DrawContext
        Returns:
        the delay in milliseconds if a redraw has been requested, otherwise 0.
      • setRedrawRequested

        public void setRedrawRequested​(int redrawRequested)
        Description copied from interface: DrawContext
        Requests that a new frame should be generated by the SceneController.
        Specified by:
        setRedrawRequested in interface DrawContext
        Parameters:
        redrawRequested - a delay in milliseconds if a redraw is requested, otherwise 0.
      • setPickPointFrustumDimension

        public void setPickPointFrustumDimension​(java.awt.Dimension dim)
        Description copied from interface: DrawContext
        Set the size (in pixels) of the pick point frustum at the near plane.
        Specified by:
        setPickPointFrustumDimension in interface DrawContext
        Parameters:
        dim - dimension of pick point frustum
      • getPickPointFrustumDimension

        public java.awt.Dimension getPickPointFrustumDimension()
        Description copied from interface: DrawContext
        Gets the dimension of the current Pick Point Frustum
        Specified by:
        getPickPointFrustumDimension in interface DrawContext
        Returns:
        the dimension of the current Pick Point Frustum
      • addPickRectangleFrustum

        public void addPickRectangleFrustum()
        Description copied from interface: DrawContext
        Creates a frustum containing the current pick rectangle and adds it to the current list of pick frustums.

        This does nothing if the current pick rectangle is null.

        Specified by:
        addPickRectangleFrustum in interface DrawContext
      • getRenderingExceptions

        public java.util.Collection<java.lang.Throwable> getRenderingExceptions()
        Description copied from interface: DrawContext
        Gets the rendering exceptions associated with this DrawContext as a Collection of Throwable objects. If non-null, the returned Collection is used as the data structure that accumulates rendering exceptions passed to this DrawContext in DrawContext.addRenderingException(Throwable). A null collection indicates this DrawContext does not accumulate rendering exceptions.
        Specified by:
        getRenderingExceptions in interface DrawContext
        Returns:
        the Collection used to accumulate rendering exceptions, or null if this DrawContext does not accumulate rendering exceptions.
      • setRenderingExceptions

        public void setRenderingExceptions​(java.util.Collection<java.lang.Throwable> exceptions)
        Description copied from interface: DrawContext
        Sets the rendering exceptions associated with this DrawContext to the specified Collection of Throwable objects. If non-null, the specified Collection is used as the data structure that accumulates rendering exceptions passed to this DrawContext in DrawContext.addRenderingException(Throwable). A null collection indicates this DrawContext should not accumulate rendering exceptions.
        Specified by:
        setRenderingExceptions in interface DrawContext
        Parameters:
        exceptions - the Collection of exceptions to be used to accumulate rendering exceptions, or null to disable accumulation of rendering exception.
      • addRenderingException

        public void addRenderingException​(java.lang.Throwable t)
        Description copied from interface: DrawContext
        Adds the specified Throwable to this DrawContext's collection of rendering exceptions. If this DrawContext's collection is null, the specified Throwable is ignored and calling this method is benign.
        Specified by:
        addRenderingException in interface DrawContext
        Parameters:
        t - the rendering exception to add as a Throwable.
      • pushProjectionOffest

        public void pushProjectionOffest​(java.lang.Double offset)
        Description copied from interface: DrawContext
        Modifies the current projection matrix to slightly offset subsequently drawn objects toward or away from the eye point. This gives those objects visual priority over objects at the same or nearly the same position. After the objects are drawn, call DrawContext.popProjectionOffest() to cancel the effect for subsequently drawn objects.

        Note: This capability is meant to be applied only within a single Renderable. It is not intended as a means to offset a whole Renderable or collection of Renderables.

        See "Mathematics for Game Programming and 3D Computer Graphics, 2 ed." by Eric Lengyel, Section 9.1, "Depth Value Offset" for a description of this technique.

        Specified by:
        pushProjectionOffest in interface DrawContext
        Parameters:
        offset - a reference to an offset value, typically near 1.0, or null to request use of the default value. Values less than 1.0 pull objects toward the eye point, values greater than 1.0 push objects away from the eye point. The default value is 0.99.
        See Also:
        DrawContext.popProjectionOffest()
      • drawOutlinedShape

        public void drawOutlinedShape​(OutlinedShape renderer,
                                      java.lang.Object shape)
        Description copied from interface: DrawContext
        Performs a multi-pass rendering technique to ensure that outlines around filled shapes are drawn correctly when blending or ant-aliasing is performed, and that filled portions of the shape resolve depth-buffer fighting with shapes previously drawn in favor of the current shape.
        Specified by:
        drawOutlinedShape in interface DrawContext
        Parameters:
        renderer - an object implementing the OutlinedShape interface for the shape.
        shape - the shape to render.
        See Also:
        OutlinedShape
      • isSmall

        public boolean isSmall​(Extent extent,
                               int numPixels)
        Description copied from interface: DrawContext
        Indicates whether a specified extent is smaller than a specified number of pixels for the current view.
        Specified by:
        isSmall in interface DrawContext
        Parameters:
        extent - the extent to test. May be null, in which case this method returns false.
        numPixels - the number of pixels at and below which the extent is considered too small.
        Returns:
        true if the projected extent is smaller than the specified number of pixels, otherwise false.
      • getTerrain

        public Terrain getTerrain()
        Description copied from interface: DrawContext
        Returns a Terrain object that uses the current sector geometry or the current globe to compute surface points.
        Specified by:
        getTerrain in interface DrawContext
        Returns:
        a terrain object for computing surface points and intersections.
      • computeTerrainPoint

        public Vec4 computeTerrainPoint​(Angle lat,
                                        Angle lon,
                                        double offset)
        Description copied from interface: DrawContext
        Compute a model-coordinate point on the terrain.
        Specified by:
        computeTerrainPoint in interface DrawContext
        Parameters:
        lat - the point's latitude.
        lon - the point's longitude.
        offset - an distance in meters to place the point above or below the terrain.
        Returns:
        a model-coordinate point offset the specified amount from the current terrain.
      • restoreDefaultBlending

        public void restoreDefaultBlending()
        Description copied from interface: DrawContext
        Restores the current OpenGL context's blending state to its default.
        Specified by:
        restoreDefaultBlending in interface DrawContext
      • restoreDefaultCurrentColor

        public void restoreDefaultCurrentColor()
        Description copied from interface: DrawContext
        Restores the current OpenGL context's current color to its default.
        Specified by:
        restoreDefaultCurrentColor in interface DrawContext
      • restoreDefaultDepthTesting

        public void restoreDefaultDepthTesting()
        Description copied from interface: DrawContext
        Restores the current OpenGL context's depth testing state to its default.
        Specified by:
        restoreDefaultDepthTesting in interface DrawContext
      • computePointFromPosition

        public Vec4 computePointFromPosition​(Position position,
                                             int altitudeMode)
        Description copied from interface: DrawContext
        Computes a Cartesian point from a specified geographic position, applying a specified altitude mode.
        Specified by:
        computePointFromPosition in interface DrawContext
        Parameters:
        position - the position to convert.
        altitudeMode - the altitude mode.
        Returns:
        the Cartesian point corresponding to the specified position and this context's current globe or terrain.