As stated in https://stackoverflow.com/a/16257100/3286489, in order for drawVertices to draw something in Android Canvas, it need to disable Hardware acceleration using
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
I check the underlying code, it has this check
public void drawVertices(@NonNull VertexMode mode, int vertexCount, @NonNull float[] verts,
int vertOffset, @Nullable float[] texs, int texOffset, @Nullable int[] colors,
int colorOffset, @Nullable short[] indices, int indexOffset, int indexCount,
@NonNull Paint paint) {
checkRange(verts.length, vertOffset, vertexCount);
if (isHardwareAccelerated()) {
return;
}
// ... codes that perform the drawing
}
Why can't we use hardware acceleration on it?
It is not mentioned in the Android doc