解决方案 »

  1.   


    void drawVertices(VertexMode mode, int vertexCount, float[] verts, int vertOffset,
                float[] texs, int texOffset, int[] colors, int colorOffset,
                short[] indices, int indexOffset, int indexCount, Paint paint)
      

  2.   

     /**
         * Draw the array of vertices, interpreted as triangles (based on mode). The
         * verts array is required, and specifies the x,y pairs for each vertex. If
         * texs is non-null, then it is used to specify the coordinate in shader
         * coordinates to use at each vertex (the paint must have a shader in this
         * case). If there is no texs array, but there is a color array, then each
         * color is interpolated across its corresponding triangle in a gradient. If
         * both texs and colors arrays are present, then they behave as before, but
         * the resulting color at each pixels is the result of multiplying the
         * colors from the shader and the color-gradient together. The indices array
         * is optional, but if it is present, then it is used to specify the index
         * of each triangle, rather than just walking through the arrays in order.
         *
         * @param mode How to interpret the array of vertices
         * @param vertexCount The number of values in the vertices array (and
         *      corresponding texs and colors arrays if non-null). Each logical
         *      vertex is two values (x, y), vertexCount must be a multiple of 2.
         * @param verts Array of vertices for the mesh
         * @param vertOffset Number of values in the verts to skip before drawing.
         * @param texs May be null. If not null, specifies the coordinates to sample
         *      into the current shader (e.g. bitmap tile or gradient)
         * @param texOffset Number of values in texs to skip before drawing.
         * @param colors May be null. If not null, specifies a color for each
         *      vertex, to be interpolated across the triangle.
         * @param colorOffset Number of values in colors to skip before drawing.
         * @param indices If not null, array of indices to reference into the
         *      vertex (texs, colors) array.
         * @param indexCount number of entries in the indices array (if not null).
         * @param paint Specifies the shader to use if the texs array is non-null. 
         */
    这个是顶点绘制法   
    我稍微扯下吧
    VertexMode  顶点类型    比如他是三角形(连续3个顶点)或者 四边形  (连续4个顶点)等等
    vertexCount  顶点数   总共有多少个顶点绘制。
    verts[]     顶点数组  [0,0,0,1,1,0,...]  前面有xy 3组 如果是类型是三角形 他就构成一个三角形的绘制基元,往后类推。
    vertOffset   顶点数据 起始位置  可能全部绘制,也可能只绘制部分顶点。与 vertexCount 配置使用 一般为0
    texs[]        纹理数组  就是对图片等进行采样,然后去渲染顶点。(这个比较复杂,需要了解下 比如opengl渲染原理。)
    texOffset   同上offset  就是偏移量
    colors[]     颜色数组  直接用颜色渲染顶点
    colorOffset 同上offset  就是偏移量
    indices[]    顶点索引 可能只绘制部分顶点 这个就是存放那些顶点的index ,  即verts[index]
    indexOffset    同上offset  就是偏移量
    indexCount    绘制多少个索引点。
    paint         这个只有 texs[] 不空 必须提供, 提供图片之类东西 采样。更多的知识 你可以搜索下 图像渲染基础。