void FillPolygonWithVertexColor(float[] vertices, int numVertices)
 {
     //x,y,r,g,b,a
     u_useSolidColor.SetValue(0);
     a_position.LoadV2f(vertices, 6, 0);
     a_color.LoadV4f(vertices, 6, 2);
     GL.DrawArrays(BeginMode.Triangles, 0, numVertices);
 }
Example #2
0
        void DrawLine(float x1, float y1, float x2, float y2)
        {
            float dx   = x2 - x1;
            float dy   = y2 - y1;
            float rad1 = (float)Math.Atan2(
                y2 - y1,     //dy
                x2 - x1);    //dx

            float[] vtxs = new float[] {
                x1, y1, 0, rad1,
                x1, y1, 1, rad1,
                x2, y2, 0, rad1,
                //-------
                x2, y2, 1, rad1
            };
            u_useSolidColor.SetValue(1);
            u_solidColor.SetValue(0f, 0f, 0f, 1f);//use solid color
            a_position.LoadV4f(vtxs, 4, 0);
            u_linewidth.SetValue(2.0f);
            GL.DrawArrays(BeginMode.TriangleStrip, 0, 4);
        }