
  $ title     "Smoke"
  % ExplicitMain
  uses OpenglSceneFrame
  uses glo2\particles

  sub ColorTriangle
  =================
  glBegin GL_TRIANGLES
  glColor4f   1.0, 0.0, 0.0, 0.99 : glVertex3f   0.0,  1.0, 0.0
  glColor4f   0.0, 1.0, 0.0, 0.99 : glVertex3f  -1.0, -1.0, 0.0
  glColor4f   0.0, 0.0, 1.0, 0.99 : glVertex3f   1.0, -1.0, 0.0
  glEnd
  end sub

  sub ColorQuad
  =============
  glBegin GL_QUADS
  glColor4f   1.0, 0.0, 0.0, 0.99 : glVertex3f  -1.0, -1.0, 0.0
  glColor4f   0.0, 1.0, 0.0, 0.99 : glVertex3f   1.0, -1.0, 0.0
  glColor4f   0.0, 0.0, 1.0, 0.99 : glVertex3f   1.0,  1.0, 0.0
  glColor4f   0.5, 0.5, 0.5, 0.99 : glVertex3f  -1.0,  1.0, 0.0
  glEnd
  end sub

  sub initialize(sys hWnd)
  '=======================
  seed=0x12345678
  glGenTextures 2, texn
  MinTexture texn[1],0xffffffff,0x80ffffff,0x00ffffff
  MinTexture texn[2],0xffffffff,0x80ffffff,0x00000000
  end sub

  sub Release(sys hwnd)
  '====================
  glDeleteTextures 2, texn
  end sub

  smoke sm
  sys count

  sub scene(sys hWnd)
  '==================
  '
  static single s1,s2,s3,s4,ang1,angi1=1,ra,ri
  '
  ActiveFrame
  glClearColor 0.5, 0.5, 0.7, 0.0
  Fog          0.5, 0.5, 0.7, 0.1 'rgb and density
  '
  glPushMatrix
  gltranslatef    6.0, 0.0, -16.0
  glrotatef    ang1,0,1,0
  ColorTriangle
  glPopMatrix
  '
  glPushMatrix
  gltranslatef    2.0, 0.0, -8.0
  glrotatef    ang1,0,1,0
  ColorTriangle
  glPopMatrix
  '
  glPushMatrix
  gltranslatef    0.0, 0.0, -4.0
  glrotatef    ang1,0,1,0
  ColorTriangle
  glPopMatrix
  '
  'SMOKE
  glEnable GL_TEXTURE_2D
  glBindTexture GL_TEXTURE_2D,texn[2]
  glPushMatrix
  gltranslatef 0.0, 0.0, -2.0
  sm.r<=.99,.5,.0
  sm.render 20 'max 50
  glPopMatrix
  glDisable GL_TEXTURE_2D
  '
  ang1+=angi1
  if ang1>360 then ang1-=360
  sleep 12
  '
  end sub



  MainWindow width,height,WS_OVERLAPPEDWINDOW,2
