  uses glTransA

  'ARRAY OF MODEL VIEW MATRICES
  '
  %mmax 0x1000
  float matf[mmax*16] 'matrix array
  float vz[mmax]      'float array for z (translation)
  sys   midx[mmax]    'index for ascending-order of z

  % BackGroundColor 0.5, 0.5, 0.7, 0.0

  sub scene(sys hWnd)
  ===================
  '
  PrepareSceneFrame
  StandardLighting     li
  TranslucentMaterial  mt,0.5
  '
  type rgba
    int c
    =
    byte r,g,b,a
  end type
  '
  if not opening then jmp fwd renders

  CreateSynthTexture imgn1, int { 0x8800ffff }, bytesof
  CreateSynthTexture imgn2, int { 0xff00ffff,0xff0000ff,0xff0000ff,0xff0000ff }, 16
  static int vv={ 0xff00ffff,0xff0000ff,0xff0000ff,0xff0000ff }
  CreateSynthTexture imgn3,vv

  CreateSynthTexture imgn4, int {
  0xff0000ff,0xff0000ff,0xff0000ff,0xff0000ff,
  0xff0000ff,0xff00ffff,0xff0000ff,0xff0000ff,
  0xff0000ff,0xff0000ff,0xffff00ff,0xff0000ff,
  0xff0000ff,0xff0000ff,0xff0000ff,0xff0000ff 
  },bytesof

  CreateSynthTexture imgn5, rgba {
  0xff0000ff,0xff0000ff,0xff0000ff,
  0xff0000ff,0xff00ffff,0xff0000ff,
  0xff0000ff,0xff0000ff,0xff0000ff
  },bytesof

  rgba b = { 0x00c08080 }
  rgba f = { 0xff00ffff }
  CreateSynthTexture imgn6, rgba {
  b.c , b.c, b.c,
  b.c , f.c, b.c,
  b.c , b.c, b.c
  },bytesof

  '
  renders:
  '
  ShaderProgram shaderMin.ph
  ShaderTexture shaderMin.t0, 1, imgn6
  '
  '
  'GENERATE ARRAY OF TRANSFORMS
  float ang2,ang3
  sys   i,j,k,m
  sys   n=8
  float ang=360/n
  float d=tan(rad(90-ang/2))
  '
  j=0 : k=0
  for m=0 to 1 'with inner circle
  for i=0 to <n
    ang2=i*ang
    ang3=ang1+ang2
    ' 
    loadidentity
    translatef   0,0,-7
    if m then  scalef .5,.5,.5
    rotatef      20,  1,0,0
    if m then  translatef 1,0,0
    rotatef      ang3,0,1,0
    translatef   0,0,d
    savematrix   matf(j)
    '
    vz[k]=matf[j+14] 'COLLECT Z DISPLACEMENT
    j+=16 : k+=1
  next
  next
  '
  'ARRANGE PANELS INTO ASCENDING Z ORDER
  sortindex vz, midx, k
  '
  'RENDER PANELS IN Z ORDER (FARTHEST FIRST)
  sys nn=n*m
  for i=0 to <nn
    j=midx[i]*16 'SELECT MATRIX VIA INDEX (ASCENDING ORDER)
    loadmatrix  matf[j]
   'translormf  v[12],v[112],4      'TRANSLATION ONLY (FOR SIGNBOARDING)
    transformf  v[12],v[112],4      'FULL TRANSFORM
   'transnormf  v[24],v[124],1      'FOR NORMALS
    ColorQuad
  next
  ShaderProgram -1
  texture   -1
  '
  end sub



  MainWindow width,height,WS_OVERLAPPEDWINDOW
