It's easier to start with
DrawPrimitives() - you feed it:
1. order - how many "vertices" shall be used per primitive
2. count - how many primitives shall be drawn
3. vertices - the x/y screen coordinates of your vertices provided as continuous float array, e.g. [x0,y0, x1,y1, x2,y2, x3,y,3]
4. texcoords - the s/t texture coordinates (sometimes also called u/v) of your vertices, also provided as continuous float array. Texture coordinates go from 0,0 (top left corner of your texture) to 1,1 (bottom right corner of your texture)
5. material - material, from which the texture and shader data is extracted. You can load an image file as Material (using
Material.load()) or access an Image's material by the image.Material() property.
Something like this should work (untested, I don't have access to CX right now):
Cerberus:
Local material:Material = Material.load("myfile.png", 0)
' where to draw
Local x1:Float = 32
Local x2:Float = x1 + 64
Local y1:Float = 32
Local y2:Float = y1 + 64
' provide four vertices from those coordinates as array
Local verts:Float[] = [x1,y1, x2,y1, x2,y2, x1,y2]
' piece of texture to draw
Local s1:Float = 0
Local s2:Float = 0.5
Local t1:Float = 0
Local t2:Float = 0.5
' provide texture coordinates for vertices
Local texcs:Float[] = [s1,t1, s2,t1, s2,t2, s1,t2]
' draw one quad (1 primitive consisting of 4 vertices)
mycanvas.DrawPrimitives(4, 1, verts, texcs, material)
Pretty straight forward. The twist with DrawIndexedPrimitives is that it allows you to reuse vertices. E.g: you can feed it 6 vertex coordinate pairs (in xy and st each) and tell it, with the indices, which pairs to use, like
verts:Float[] = [x1,y1, x2,y1, x3,y1, x1,y2, x2,y2, x3,y3]
idxs:Int[] = [0, 1, 4, 3]
(and order=4, count=1)
would draw a quad from x1,x1 - x2,y1 - x2,y2 - x1,y2 (you'll find these pairs at given indexes in verts[])