Interface SingleFrameGlTextureProcessor


  • public interface SingleFrameGlTextureProcessor
    Manages a GLSL shader program for processing a frame. Implementations generally copy input pixels into an output frame, with changes to pixels specific to the implementation.

    Methods must be called in the following order:

    1. The constructor, for implementation-specific arguments.
    2. initialize(Context, int, int, int), to set up graphics initialization.
    3. drawFrame(long), to process one frame.
    4. release(), upon conclusion of processing.
    • Method Detail

      • initialize

        void initialize​(Context context,
                        int inputTexId,
                        int inputWidth,
                        int inputHeight)
                 throws IOException
        Performs all initialization that requires OpenGL, such as, loading and compiling a GLSL shader program.

        This method may only be called if there is a current OpenGL context.

        Parameters:
        context - The Context.
        inputTexId - Identifier of a 2D OpenGL texture.
        inputWidth - The input width, in pixels.
        inputHeight - The input height, in pixels.
        Throws:
        IOException - If an error occurs while reading resources.
      • getOutputSize

        Size getOutputSize()
        Returns the output Size of frames processed through drawFrame(long).

        This method may only be called after the texture processor has been initialized.

      • drawFrame

        void drawFrame​(long presentationTimeUs)
                throws FrameProcessingException
        Draws one frame.

        This method may only be called after the texture processor has been initialized. The caller is responsible for focussing the correct render target before calling this method.

        A minimal implementation should tell OpenGL to use its shader program, bind the shader program's vertex attributes and uniforms, and issue a drawing command.

        Parameters:
        presentationTimeUs - The presentation timestamp of the current frame, in microseconds.
        Throws:
        FrameProcessingException - If an error occurs while processing or drawing the frame.
      • release

        void release()
        Releases all resources.