Kotlin

Creating a custom Renderer (MyRenderer)

Now you'll create a custom renderer that will actually load the frame data and pass it to OpenGL textures. It will be used to apply the inverted-color fragment shader.

Below is an outline; you will adapt shader code later.

  1. Create a kotlin class MyRenderer (can be internal to InvertedColorsVideoRenderer)
  1. Let's examine the displayFrame method. It is important to note that the frame that the sdk sends to the Renderer in the onFrame method is now property of the Renderer. It is up to this class to destroy the frame when it is not needed anymore. That's why we destroy previous frame when a new one comes to the Renderer