library / com.otaliastudios.zoom / ZoomSurfaceView / onDrawFrame

onDrawFrame

@WorkerThread open fun onDrawFrame(gl: GL10): Unit

Performs the texture and background drawing.

An old version of this acted on surfaceTextureTransformMatrix instead of the rect modelMatrix. This has the drawback that any "background" (overscrolls, zoom < 1, ...) will draw the CLAMP_TO_BORDER texture mess and there's no way around that.

The current version acts on textureRect.modelMatrix instead. In both cases there are some issues here.

  1. We passed the video size to the engine. So we must UNDO some default behavior of SurfaceView. This is done and documented in onContentOrContainerSizeChanged.
  2. OpenGL will apply translation first then scale, which is typically not what we want.
  3. OpenGL will scale with respect to some fixed point, which is typically not the pan origin. (if we work on modelMatrix, this point is the translated viewport center)
  4. OpenGL Y coordinates are reversed.