
  $ FileName "t.exe"
  'uses rtl32
  'uses rtl64
  string title="Rotating Image"
  uses OpenglSceneFrame

  sys GdiplusToken
  sys texn[16]





  '-----------------------
  sub Initialize(sys hWnd)
  '=======================

  GDIplus 1
  sys hr
  '
  'Prepare Textures
  '----------------
  '
  glGenTextures 2, texn
  '
  static sys res=512
  string imgs[1]=""
  LoadPixImage "../images/Dawn1815.jpg",res,imgs[1]
  MakeTexture strptr imgs[1],res,res,texn[1]
  '

  end sub 'initialize



  sub Release(sys hWnd)
  '====================
  glDeleteTextures 1, texn
  Gdiplus 0
  '
  end sub 



  sub scene(sys hWnd)
  '==================
  '
  Snapshots hwnd 'Ctrl-P to take snapshot
  '
  static single ang1, angi1=1
  static single sx,sy,sz
  '
  glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
  glClearColor 0.5, 0, 0, 0
  glLoadIdentity
  '
  'ACTIVATE TEXTURE
  '----------------
  '
  glEnable GL_TEXTURE_2D
  glBindTexture GL_TEXTURE_2D,texn[1]
  '
  sx=0.2 : sy=0.16 : sz=-1
  'sx=0.5 : sy=0.40 : sz=-1
  '
  '
  'MOVEMENT
  '--------
  '

  'glrotatef ang1, 0,0,1
  single x=cos(rad(ang1))*.1 ,y=sin(rad(ang1))*.1,z=0
  gltranslatef x,y,z
  '
  'DRAW SHAPE
  '----------
  '
  'this quad is drawn clockwise
  '
  glbegin GL_QUADS
  '
  glTexCoord2f 0,0 : glvertex3f -sx, -sy,  sZ
  glTexCoord2f 0,1 : glvertex3f -sx,  sy,  sZ
  glTexCoord2f 1,1 : glvertex3f  sx,  sy,  sZ
  glTexCoord2f 1,0 : glvertex3f  sx, -sy,  sZ
  '
  glend
  '
  glDisable GL_TEXTURE_2D
  '
  '
  'UPDATE ROTATION ANGLES
  '----------------------
  '
  ang1+=angi1 : if ang1>=360 then ang1-=360
  '
  '
  end sub


