
  $ FileName  "t.exe"
  'uses RTL32.inc"
  'uses RTL64
  $ title     "Textured Cubes in Fog"
  uses OpenglSceneFrame
  uses glo2\textures

  indexbase 1
  sys   GdiplusToken
  float ang1
  float li[16]
  float ma[13]
  sys cube,pent
  

  sub initialize(sys hWnd)
  ========================
  '
  GDIplus 1
  '
  BuildTextures 16,256
  '
  pent=CompileList : Sides 5,1,1 : glEndList
  cube=CompileList : CubeForm    : glEndList
  '
  StandardLighting li
  StandardMaterial ma
  '
  end sub

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

  sub RenderCube(float x,y,z,sc,sys tex)
  ======================================
  glBindTexture GL_TEXTURE_2D,tex
  glPushMatrix
  gltranslatef x,y,z
  glrotatef    ang1,0,1,0
  glscalef sc,sc,sc
  glCallList cube
  'glCallList pent
  glPopMatrix
  end sub


  sub scene(sys hWnd)
  '==================
  '
  static single ra,ri,angi1=.5
  '
  SnapShots hWnd 'Ctrl-P take snapshot
  NewFrame
  glClearColor 0.5, 0.5, 0.7, 0.0
  Fog          0.5, 0.5, 0.7, 0.1 'rgb and density
  '
  glEnable GL_LIGHTING
  glEnable GL_NORMALIZE
  glColor4f .99,.99,.99,.99
  '
  sys t1=texn[10]
  sys t2=texn[11]
  '
  glEnable GL_TEXTURE_2D
  RenderCube   6.5, 0.4,-16.0,0.5,t1
  RenderCube   2.5, 0.4,-8.0, 0.5,t1
  RenderCube   0.5, 0.4,-4.0, 0.5,t1
  RenderCube  -0.5, 0.4,-2.0, 0.5,t1
  '
  RenderCube   6.5,-0.9,-16.0,0.5,t2
  RenderCube   2.5,-0.9,-8.0, 0.5,t2
  RenderCube   0.5,-0.9,-4.0, 0.5,t2
  RenderCube  -0.5,-0.9,-2.0, 0.5,t2
  glDisable GL_TEXTURE_2D
  '
  ang1+=angi1
  if ang1>360 then ang1-=360
  sleep 10
  end sub
