cats-oss / android-gpuimage

Android filters based on OpenGL (idea from GPUImage for iOS)
8.98k stars 2.26k forks source link

GPUImageTriangularMeshFilter: a canvas.drawVertices alternative #496

Closed wpmed92 closed 2 years ago

wpmed92 commented 4 years ago

What does this change?

This change adds a new filter called GPUImageTriangularMeshFilter. This filter supports passing vertex and texture coordinates to it, and renders them using GL_TRIANGLES.

What is the value of this and can you measure success?

The value of it is that it can be used instead of canvas.drawVertices when one needs performant image warping. This filter is currently used in production in our app VIMAGE in the Path animator tool. This tool warps an image by drawing a path on the image. The image is triangulated based on the path using OpenCV subdiv2D. The triangle vertices are then displaced by some amount while the texture coordinates are left intact. This results in a warp.

Screenshots

vimage_no_warp vimage_paths vimage_warped