  #compact
  $ FileName  "co.exe"
  'uses RTL64
  'uses console
  '
  % ExplicitMain
  $ title        "Array of Slider Panels"
  $ fontA        "Arial",FW_SEMIBOLD

  'macro keydown
  'case 27 : 'no action
  'case 32 : 'no action
  'end macro
  '
  uses OpenglSceneFrame
  uses ControlPanels

  indexbase 1
  sys       texn[16]
  sys       GdiplusToken
  float     ang1
  sys       cube,pent


  sub initialize(sys hWnd)
  ========================
  '
  GDIplus 1
  '
  cube=CompileList : CubeForm    : glEndList
  end sub


  sub Release(sys hwnd)
  '====================
  glDeleteLists    cube,1 
  glDeleteLists    pent,1 
  Gdiplus 0
  end sub


  ===================
  sub scene(sys hWnd)
  ===================
  '
  static single ra,ri,angi1=.5
  static sys    initscene
  '
  DozyFrame
  glClearColor 0.1, 0.2, 0.1, 0
  BeginPick
  '
  glColor4f .99,.99,.99,.99
  'glEnable GL_TEXTURE_2D
  '
  'RENDERED LOWEST FIRST (FOR TRANSPARENCY BLENDING)
  '
  %                    ordn=10
  static ControlPanelA cb[ordn]
  static sys           ord[32]
  static sys           idb[32]
  if closing
    int i
    for i=1 to ordn
      cb[i].destructor
    next
    exit sub
  endif
  '#recordof controlpanela
  '#recordof sliders
  '#recordof lightbuttons  '
  'INITIAL PLACEMENT ETC
  '
  if initscene=0
    float px=-.1, py=.0
    sys   i
    for i=1 to ordn
      idb[i]=100*i
      ord[i]=i
      cb[i].lock=1
      cb[i].sc=.49
      cb[i].x=px
      cb[i].y=py
      px+=.2
      if i=5 then
        px=-.1
        py-=.2
      end if
    next
    initscene=1
  end if
  '
  'ORDER OF BUILD (SUPPORTING TRANSPARENCY)
  '
  'if picked and bleft
  '  sys a=1+trunc(picked/100)
  '  PlaceTop(a,ord,ordn)
  'end if 
  '
  'BUILD
  '
  glpushmatrix
  static float f = -1 - .001*ordn
  static float x,y,dx,dy,xx,yy,lock,id=1
  '
  'glDisable GL_LIGHTING
  gltranslatef  x,y,-1.01
  QuadShadow    .51,.25,-.005,.5
  glcolor4f     .10,.20,.40,.9
  PickLabel     01
  QuadTex       .51,.25,.000
  '
  if bleft
    if picked=id
      if not lock
        drag(dx,dy,1.2)
        x=xx+dx : y=yy+dy
      end if
    end if
  else
    xx=x : yy=y 'ANCHOR
  end if
  sys i,j
  gltranslatef -.05, .10, .001
  for i=1 to ordn
    j=i
    'j=ord[i]
    'gltranslatef .0, .0, .001 'next micro-layer in front
    cb[j].act idb[j]
  next
  glpopmatrix
  '
  '
  EndPick
  '
  ang1+=angi1
  if ang1>=360 then ang1-=360
  '
  end sub
  '
  MainWindow width,height,WS_OVERLAPPEDWINDOW 'WS_POPUP | WS_BORDER '
