  #compact
  $ FileName  "co.exe"
  'uses RTL64
  'uses console
  '
  % ExplicitMain
  $ title        "Panels Overlap"
  $ 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.5, 0.5, 0.7, 0
  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=3
  static ControlPanelA cb[ordn]
  static int           ord[16]
  static int           idb[16]
  '
  if closing
    int i
    for i=1 to 3
      cb[i].destructor
    next
    exit sub
  endif
  '
  'INITIAL PLACEMENT ETC
  '
  if initscene=0
    ord={1,2,3}
    idb={0,100,200}
    cb[1].x=.0 : cb[1].y=.0
    cb[2].x=.1 : cb[2].y=.05
    cb[3].x=.2 : cb[3].y=.10
    int i
    for i=1 to ordn : cb[i].sc=1 : next
    initscene=1
  end if
  '
  'ORDER OF BUILD (SUPPORTING TRANSPARENCY)
  '
  if picked and bleft
    int a=1+trunc(picked/100)
    PlaceTop(a,ord,ordn)
  end if 
  '
  'BUILD
  '
  glpushmatrix
  static float layr=.001
  static float f = -1 - layr*ordn
  gltranslatef .0, .0, f
  int i,j
  for i=1 to ordn
    j=ord[i]
    cb[j].act idb[j]
    gltranslatef .0, .0, layr 'next micro-layer in front
  next
  glpopmatrix
  '
  '
  EndPick
  '
  ang1+=angi1
  if ang1>=360 then ang1-=360
  '
  end sub
  '
  MainWindow width,height,WS_OVERLAPPEDWINDOW 'WS_POPUP
