
  $ FileName  "t.exe"
  'uses RTL32
  'uses RTL64
  $ title     "Textured Cones in Fog"
  uses OpenglSceneFrame
  uses glo2\shapes
  uses glo2\textures
  uses glo2\materials
  uses glo2\particles

  indexbase 1
  sys   GdiplusToken
  float ang1
  sys cube,pent
  

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

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

  sub RenderCone(float x,y,z,sc,rz,ry,sys n,sm,tex)
  =================================================
  glBindTexture GL_TEXTURE_2D,tex
  glPushMatrix
  gltranslatef  x,y,z
  glrotatef     ang1,0,1,0
  glscalef      sc,sc,sc
  ConeFaces     n,rz,ry,sm
  glPopMatrix
  end sub

  sub scene(sys hWnd)
  '==================
  '
  static single ra,ri,angi1=.5
  sys   t1=texn[10] 'texture
  sys   t2=texn[11] 'texture
  sys   n=16        'sides
  float ra=0.0      'top/base ratio
  float ry=1.5      'height/base ratio
  float sm
  '
  ActiveFrame
  glClearColor     0.5, 0.5, 0.7, 0.0
  Fog              0.5, 0.5, 0.7, 0.05 'rgb and density
  StandardLighting li
  StandardMaterial ma
  '
  glEnable GL_TEXTURE_2D

  'shape locate x,y,z,size,ra,ry,nside,norm,tex
  ---------------------------------------------
  sm=0
  RenderCone   6.5, 0.4,-16.0, 0.5,ra,ry,n,sm,t1
  RenderCone   2.5, 0.4,-8.0 , 0.5,ra,ry,n,sm,t1
  RenderCone   0.5, 0.4,-4.0 , 0.5,ra,ry,n,sm,t1
  RenderCone  -0.5, 0.4,-2.0 , 0.5,ra,ry,n,sm,t1
  '
  sm=1.0
  RenderCone   6.5,-0.9,-16.0, 0.5,ra,ry,n,sm,t2
  RenderCone   2.5,-0.9,-8.0 , 0.5,ra,ry,n,sm,t2
  RenderCone   0.5,-0.9,-4.0 , 0.5,ra,ry,n,sm,t2
  RenderCone  -0.5,-0.9,-2.0 , 0.5,ra,ry,n,sm,t2
  glDisable GL_TEXTURE_2D
  '
  ang1+=angi1
  if ang1>360 then ang1-=360
  sleep 10
  end sub
