a2StartTriangleBatch

This command begins a filled shape batch drawing operation.

  Syntax
a2StartTriangleBatch batchSize
  Parameters
batchSize
Boolean
An estimate of how many filled shapes will be drawn in this batch.
  Returns

This command does not return a value.

  Description

This command begins an Advanced 2D filled shape drawing batch operation. The command works with all the filled shapes. The batch size is an estimate of how many shapes are to be drawn. It doesn't matter if it's too big or too small, but the closer it is the more efficient the batch.

  Example Code
a = timer()

for x = 1 to 100000
    x1 = rnd(screen width())
    y1 = rnd(screen height())
    x2 = rnd(screen width())
    y2 = rnd(screen height())
    x3 = rnd(screen width())
    y3 = rnd(screen height())
    a2FillTriangle x1, y1, x2, y2, x3, y3, rgb(rnd(255), rnd(255), rnd(255))
next x

t1 = timer()-a
a = timer()
a2StartTriangleBatch 100000

for x = 1 to 100000
    x1 = rnd(screen width())
    y1 = rnd(screen height())
    x2 = rnd(screen width())
    y2 = rnd(screen height())
    x3 = rnd(screen width())
    y3 = rnd(screen height())    
    a2FillTriangle x1, y1, x2, y2, x3, y3, rgb(rnd(255), rnd(255), rnd(255))
next x

a2EndBatch
t2 = timer()-a
set text opaque
print "No batch:";t1;" milliseconds"
print " Batched:";t2;" milliseconds"

WAIT KEY
  See also

a2StartDotBatch
a2StartLineBatch
a2EndBatch
Advanced 2D Index
Main Menu