I only have a proper demo for THIS library, the only demo I still have for the old library simply draws triangles at random positions.

NOTE: I suspect that on most systems this will run slower than on my system.

`CONST zmode = 0`

CONST zmax~&& = (256 ^ (zmode + 1)) - 1

PRINT zmax

CONST zsize = zmax / 4

'$include:'triangle.bi'

DIM SHARED texture AS LONG, atexture AS LONG

DIM SHARED tz(-(zmax * 8) TO (zmax * 8))

DIM p AS _INTEGER64

DIM zp AS _FLOAT

zp = .1 ^ (1 / (zmax * 8))

PRINT zp

FOR p = -(zmax * 8) TO zmax * 8

tz(p) = zp ^ p

NEXT p

atexture = _SCREENIMAGE

tw = _WIDTH(atexture)

th = _HEIGHT(atexture)

xsize = (tw / 3) + 1

ysize = xsize * 9 / 16

texsize = (tw / 1)

teysize = (th / 1)

texture = _NEWIMAGE(texsize, teysize, 32)

tsx = _WIDTH(atexture) / 2

tsy = _HEIGHT(atexture) / 2

CONST NODES = 65

CONST SUBNODES = 65

CONST RINGSIZE = 300

'CONST DIAMETER = 400

CONST CentY = 0

CONST centz = zmax / 4

CONST centx = 0 'RINGSIZE

CONST twist = 0

CONST ptwist = 1

CONST qrot = 3

CONST prot = 1

CONST mrot = 8

CONST refrate = 1

CONST VD = RINGSIZE + DIAMETER

rad = ATN(1) * 4 / 180

DIM SHARED n(NODES, SUBNODES) AS vector

FOR p = 0 TO NODES - 1

ap = (180 * p / (NODES - 1)) + 180

FOR q = 0 TO SUBNODES - 1

cp = (180 * q / (SUBNODES - 1)) - 90

caa = COS(cp * rad)

saa = SIN(cp * rad) * RINGSIZE

n(p, q).x = COS(ap * rad) * RINGSIZE * caa

n(p, q).z = SIN(ap * rad) * RINGSIZE * caa

n(p, q).y = saa

n(p, q).z = (zsize * n(p, q).z / VD) + centz

n(p, q).x = (xsize / 2) + ((n(p, q).x - centx) * tz(n(p, q).z * 8))

n(p, q).y = (ysize / 2) + ((n(p, q).y - CentY) * tz(n(p, q).z * 8))

cp = ((360 * p * INT(ptwist) / NODES) + (360 * q * INT(twist) / SUBNODES)) MOD 360

ar = h(cp)

ag = h((cp + 120) MOD 360)

ab = h((cp + 240) MOD 360)

n(p, q).col.r = ar

n(p, q).col.g = ag

n(p, q).col.b = ab

n(p, q).t = texture

NEXT q

NEXT p

maxrot = 45

DIM testvec AS vector

testvec.x = 128

testvec.y = 128

testvec.z = 128

testvec.col.r = 128

testvec.col.g = 128

testvec.col.b = 128

testvec.t = 128

DIM target AS zbuffer

zin target, xsize, ysize, zmode

DIM a AS vector, b AS vector, c AS vector, d AS vector

DIM ta AS trivec

SCREEN target.a

_SCREENMOVE _MIDDLE

texture = _SCREENIMAGE

PRINT testvec.x

PRINT testvec.y

PRINT testvec.z

PRINT testvec.col.r

PRINT testvec.col.g

PRINT testvec.col.b

PRINT testvec.t

PRINT

DIM vt AS DOUBLE

FOR u = 0 TO 6

vt = checkvec(testvec, u)

PRINT vt

NEXT u

PRINT

PRINT target.a

PRINT target.b

PRINT target.c

DIM stime AS _FLOAT, etime AS _FLOAT

stime = TIMER(.001)

FOR t = 0 TO 512 * 8 / mrot

zcls target

IF t MOD refrate = 0 THEN

IF atexture <> 0 THEN _FREEIMAGE (atexture)

atexture = _SCREENIMAGE

_PUTIMAGE , atexture, texture, (tsx - (texsize / 2), tsy - (teysize / 2))-(tsx + (texsize / 2), tsy + (teysize / 2))

END IF

_PUTIMAGE , texture, target.a

FOR p = 0 TO NODES - 2

FOR q = 0 TO SUBNODES - 2

ap = (p + 1) MOD NODES

aq = (q + 1) MOD SUBNODES

a = n(p, q)

b = n(ap, q)

c = n(p, aq)

d = n(ap, aq)

ap = (p + 1)

aq = (q + 1)

ax = INT(511 * p / NODES / 2) + (t * prot * mrot)

bx = INT(511 * ap / NODES / 2) + (t * prot * mrot)

ay = INT(511 * q / SUBNODES) + (t * qrot * mrot)

by = INT(511 * aq / SUBNODES) + (t * qrot * mrot)

ax = ax MOD 512

bx = bx MOD 512

ay = ay MOD 512

by = by MOD 512

IF bx < ax THEN bx = bx + 512

IF by < ay THEN by = by + 512

a.col.r = ax \ 4

b.col.r = bx \ 4

c.col.r = ax \ 4

d.col.r = bx \ 4

a.col.g = ay \ 4

b.col.g = ay \ 4

c.col.g = by \ 4

d.col.g = by \ 4

a.col.b = 7 + ((ax MOD 4) * 16) + ((ay MOD 4) * 64)

b.col.b = 7 + ((bx MOD 4) * 16) + ((ay MOD 4) * 64)

c.col.b = 7 + ((ax MOD 4) * 16) + ((by MOD 4) * 64)

d.col.b = 7 + ((bx MOD 4) * 16) + ((by MOD 4) * 64)

a.t = texture

b.t = texture

c.t = texture

d.t = texture

triangle a, b, c, 0, 1

triangle d, b, c, 0, 1

NEXT q

NEXT p

_DISPLAY

ft = t

NEXT t

etime = TIMER(.001)

_DEST 0

fps = ft / (etime - stime)

PRINT fps

PRINT fps * NODES * SUBNODES

_DISPLAY

SLEEP

SYSTEM

FUNCTION h (u)

IF u <= 60 THEN h = 255

IF u >= 300 THEN h = 255

IF u > 60 AND u < 120 THEN h = 255 - (255 * (u - 60) / 60)

IF u > 240 AND u < 300 THEN h = (255 * (u - 240) / 60)

END FUNCTION

FUNCTION range (v, min, max)

IF v >= min AND v <= max THEN range = -1

END FUNCTION