Class InputGLBinding

  • Direct Known Subclasses:
    PictureGLBinding

    public abstract class InputGLBinding
    extends Object
    InputGLBinding represents a GL state of an InputViewsAsset. In general, this class is designed to be used only from a GL thread and is not thread-safe. But it also gracefully handles when GL context is lost, so it's safe to release it from a non-GL thread. InputGLBinding is weakly coupled to InputViewsAsset because GL state is owned by GL thread but InputGLBinding is invalidated when the original InputViewsAsset is released.
    • Field Detail

      • GL_TEXTURE_PROTECTED_EXT

        public static int GL_TEXTURE_PROTECTED_EXT
        When InterlacedSurfaceView configured to display protected (aka DRM) content, Views texture must be set up with GL_TEXTURE_PROTECTED_EXT parameter set to GL_TRUE.
        See Also:
        InterlacedRenderer.EGL_PROTECTED_CONTENT_EXT
      • mIsValid

        protected volatile boolean mIsValid
        InputGLBinding invalidated when it's or its asset is released. When invalidated, views texture must be released.
    • Method Detail

      • close

        public void close()
        Reset to the clean state and invalidate the binding. Safe to call from a non-GL thread if InterlacedRenderer GLThread is stopped.
      • isValidGLContext

        public boolean isValidGLContext()
        Use it to determine whether GL resources can be released on this thread. If a GL resource was allocated on another thread, there is nothing that can be done from the current thread. The GL resource is either already has been released automatically on GL context release or it will be.
        Returns:
        whether the current thread is the GL thread on which this binding was initialized
      • update

        protected void update​(InterlacedRenderer renderer,
                              boolean isProtected)
        Update the state. This method is used to initialize and/or update views texture. After this method, if the binding is still valid, getViewsTexture must return a valid texture.
        Parameters:
        renderer - current renderer that will interlace the views texture.
        isProtected - whether the views texture should be configured as protected.
        See Also:
        GL_TEXTURE_PROTECTED_EXT
      • updateViewScreenPosition

        protected void updateViewScreenPosition​(Interlacer interlacer,
                                                int posX,
                                                int posY)
      • reset

        protected void reset()
        Reset to the clean state.
      • render

        protected abstract void render​(InterlacedRenderer renderer,
                                       int viewportWidth,
                                       int viewportHeight,
                                       boolean isRoot)
        Render views using the interlacer.
      • logThread

        protected void logThread​(String subTag)