
  $ FileName "t.exe"
  'uses RTL32
  'uses RTL64
  %vtitle="Move through scene using keyboard arrow keys (shift to rotate)"
  % ExplicitMain
  uses OpenglSceneFrame
  uses glo2\shapes
  uses glo2\textures
  uses glo2\materials
  uses glo2\particles

  indexbase 1
  sys   GdiplusToken
  float ang1
  sys   cube,sphere,pface
  Cloud cloud1

  sub PlanetGrid(sys face)
  =========================
  glPushMatrix
  glCallList face
  glRotatef 90.0,0,1,0
  glCallList face
  glRotatef 90.0,0,1,0
  glCallList face
  glRotatef 90.0,0,1,0
  glCallList face
  glRotatef 90.0,1,0,0
  glCallList face
  glRotatef 180.0,1,0,0 'top
  glCallList face
  glPopMatrix
  end sub


  sub initialize(sys hWnd)
  ========================
  '
  GDIplus 1
  '
  '
  cube=CompileList   : CubeForm        : glEndList
  sphere=CompileList : Spheric 1,1,6   : glEndList
  pface=CompileList : CubicFace 8,0.,1 : glEndList
  '
  end sub

  sub Release(sys hwnd)
  '====================
  DeleteAllGlCompiled
  Gdiplus 0
  end sub

  sub scene(sys hWnd)
  '==================
  '
  static single ra,ri,angi1=.1
  '
  ActiveFrame
  glClearColor 0.5, 0.5, 0.7, 0.0
  Fog          0.5, 0.5, 0.7, 0.030 'rgb and density
  StandardLighting li
  StandardMaterial ma
  '
  '
  '
  'VIEW CONTROL WITH KEYBOARD KEYS
  '
  static float cmmx,cmmy,cmmz,cmax,cmay,cmaz
  glrotatef    cmax,1,0,0 'rotate yz : pitch
  glrotatef    cmay,0,1,0 'rotate xz : yaw
  glrotatef    cmaz,0,0,1 'rotate xy : yaw
  glTranslatef cmmx,cmmy,cmmz
  '
  if not key[16] 'shift'
    if key[37] then cmmx+=.01*cos(rad(cmay)) : cmmz+=.01*sin(rad(cmay))
    if key[39] then cmmx-=.01*cos(rad(cmay)) : cmmz-=.01*sin(rad(cmay))
    if key[38] then cmmx-=.01*sin(rad(cmay)) : cmmz+=.01*cos(rad(cmay))
    if key[40] then cmmx+=.01*sin(rad(cmay)) : cmmz-=.01*cos(rad(cmay))
    if key[33] then cmmy-=.01
    if key[34] then cmmy+=.01
  else
    if key[37] then cmay-=1
    if key[39] then cmay+=1
    if key[38] then cmax-=1
    if key[40] then cmax+=1
    if key[33] then cmaz+=1
    if key[34] then cmaz-=1
    if key[36] 
      cmax=0. : cmay=0. : cmaz=0. 'HOME'
    end if
  end if
  '
  '
  Material White
  '
  glPushMatrix
  glTranslatef 2.5,-1.0,-6.0
  glScalef      .5,.5,.5
  glCallList sphere
  glPopMatrix
  '
  'SPHERES
  glPushMatrix
  indexbase 1
  glTranslatef -20.,10.,-60.0
  Material Red
  glScalef      6.,6.,6.
  glCallList sphere
  Material White
  glPopMatrix
  '
  glPushMatrix
  glTranslatef 2.5,-1.0,-6.0
  glScalef      .5,.5,.5
  glCallList sphere
  glPopMatrix
  '
'   glDisable GL_LIGHTING

  'PLANETARY GRID
  glPushMatrix
  glTranslatef 1.0,2.0,-15.0
  glScalef      4.,4.,4.
  glRotatef ang1,0,1,0
  PlanetGrid pface
  glPopMatrix
  '
  'PLANETARY GRID
  glPushMatrix
  glTranslatef 0.0,-32.0,-32.0
  glScalef      32.,32.,32.
  glRotatef ang1,0,1,0
  glRotatef ang1,1,0,0
  PlanetGrid pface
  glPopMatrix
  '
  glDisable GL_LIGHTING
  '
  ang1+=angi1
  if ang1>360 then ang1-=360
  sleep 10
  end sub

  MainWindow width,height,WS_OVERLAPPEDWINDOW
