'TEXPANEL.O2BAS

uses consoleG 
 
  BeginScript

  procedure QuadTex(float xp=0.0,yp=0.0,xq=1.0,yq=1.0)
  ====================================================
  'Configured As Front Face
  glBegin GL_TRIANGLE_STRIP
  glNormal3f   0.0 , 0.0  , 1.0
  float u=1.0
  float n=0.0
  glTexCoord2f xp , yp
  glVertex3f -u , -u , n
  glTexCoord2f xq , yp
  glVertex3f  u , -u , n
  glTexCoord2f xp , yq
  glVertex3f -u ,  u , n
  glTexCoord2f xq , yq
  glVertex3f  u ,  u , n
  glEnd
  end procedure


  procedure CubeTex()
  ===================
  int i
  for i=0 to 3
    glpushmatrix
    rotateX i*90
    move 0,0,1.0
    QuadTex()
    glpopmatrix
  next
  for i=1 to 3 step 2
    glpushmatrix
    rotateY i*90
    move 0,0,1.0
    QuadTex()
    glpopmatrix
  next
  'ENDS ...
  move 0,0,-10.0
  end procedure


  procedure plank(float x=10.0,y=1.0,z=0.25)
  ==========================================
  pushstate
  scale x,y,z
  CubeTex()
  popstate
  end procedure


  procedure main()
  ================
  cls .5,.5,1.0
  if opening
    'sub LoadTexture(optional string fi, int n,res,*wi,*ht,*pflip)
    '
    texe=5
    static int imgn[]={1,2,3,4,5,6,7}
    static int wi[7],ht[7]
   'LoadTexture  ("..\..\images\star.jpg",imgn[1],0,Wi[1],Ht[1])
   'LoadTexture  ("..\..\images\head1.jpg",imgn[2],0,Wi[2],Ht[2])
   'LoadTexture  ("..\..\images\mud.jpg",imgn[3],0,Wi[3],Ht[3])
   'LoadTexture  ("..\..\images\fruitfly1.jpg",imgn[4],0,Wi[4],Ht[4])
   'LoadTexture  ("..\..\images\glass.jpg",imgn[5],0,Wi[5],Ht[5])
   'LoadTexture  ("..\..\images\wood1.jpg",imgn[6],0,Wi[6],Ht[6],0)
    LoadTexture  ("..\..\images\wood1.jpg",imgn[7],0,Wi[7],Ht[7],1) '1 rotate 90deg
  endif
  '
  'static MoveableObject m0
  'm0.act
  '@FrameScale=@m0.s  'coupled for zooming in/zoom out ctrl+ / ctrl-
  'if opening
  '  m0.id=0x00         'picked=0 (background)
  '  m0.mode=0x101      'left button move, right button rotate
  '  m0.s={1.0,1.0,1.0} 'initial view scale
  '  m0.x={20,-15,0}    'initial view position
  'endif
  '
  pushstate
  'UserMovement m1,100 'for moveable box
  static MoveableObject m1
  if opening
    m1.id=0x100
    m1.mode=0x101
    m1.s={1.0,1.0,1.0}
  endif
  '
  shading 'opp flat
  color 1,1,1
  texture imgn[7] 'wood
  move 15,-15,-10.0
  m1.act
  move 10.0,0,0
  glpushmatrix
  rotateX 90
  plank()
  glpopmatrix
  move 0,-20,0
  glpushmatrix
  rotateX 90
  plank()
  glpopmatrix
  int i
  move -10,10,0
  for i=1 to 2
  glpushmatrix
  rotateZ 90
  rotatex 90
  plank()
  glpopmatrix
  move 20.0,0,0
  next
  texture 0
  popstate
  '
  end procedure 'main

  EndScript