home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / VOGLE.ZIP / EXAMPLES / FLSTYLES.FOR < prev    next >
Text File  |  2000-02-11  |  3KB  |  152 lines

  1. c
  2. c A program showing basic line styles.
  3. c
  4.  
  5.     program dlines
  6.     character *40    device
  7.  
  8.     print*,'Enter output device: '
  9.     read(*, '(a)')device
  10.  
  11.     call vinit(device)
  12.     call vsetflush(0)
  13.     call up(0.0, 1.0, 0.0)
  14.     call perspective(90.0, 1.0, 0.3, 3.0)
  15.     call translate(0.0, 0.0, -1.3)
  16.  
  17.     call drawscene
  18.     call rotate(-30.0, 'y')
  19.     call rotate(-30.0, 'x')
  20.     call drawscene
  21.  
  22.     call vexit
  23.     end
  24.  
  25.     subroutine drawscene
  26.  
  27.     integer BLACK, RED, GREEN, BLUE, YELLOW, MAGENTA, WHITE
  28.     integer CYAN
  29.     parameter(BLACK = 0)
  30.     parameter(RED = 1)
  31.     parameter(GREEN = 2)
  32.     parameter(YELLOW = 3)
  33.     parameter(BLUE = 4)
  34.     parameter(MAGENTA = 5)
  35.     parameter(CYAN = 6)
  36.     parameter(WHITE = 7)
  37.  
  38.     call color(BLACK)
  39.     call clear    
  40.  
  41.     call color(GREEN)
  42.     call setdash(0.03)
  43.         
  44.     call linestyle(' ')
  45.     call xcentertext
  46.     call move2(-0.45, 0.9)
  47.     call drawstr('Linestyle: "10"')
  48.     call move2(-0.45, 0.7)
  49.     call drawstr('Linestyle: "110"')
  50.     call move2(-0.45, 0.5)
  51.     call drawstr('Linestyle: "111010"')
  52.     call move2(-0.45, 0.3)
  53.     call drawstr('Linestyle: "0001"')
  54.  
  55.     call linestyle('10')
  56.     call move2(-0.9, 0.9)
  57.     call draw2( 0.0, 0.9)
  58.     call circle(0.6, 0.6, 0.4)
  59.  
  60.     call drawbox(0.9)
  61.     call drawsine(0.9)
  62.  
  63.     call color(RED)
  64.     call linestyle('110')
  65.     call move2(-0.9, 0.7)
  66.     call draw2( 0.0, 0.7)
  67.     call circle(0.6, 0.6, 0.3)
  68.     call drawbox(0.7)
  69.     call drawsine(0.7)
  70.  
  71.     call color(CYAN)
  72.     call linestyle('111010')
  73.     call move2(-0.9, 0.5)
  74.     call draw2( 0.0, 0.5)
  75.     call circle(0.6, 0.6, 0.2)
  76.     call drawbox(0.5)
  77.     call drawsine(0.5)
  78.  
  79.     call color(YELLOW)
  80.     call linestyle('0001')
  81.     call move2(-0.9, 0.3)
  82.     call draw2( 0.0, 0.3)
  83.     call circle(0.6, 0.6, 0.1)
  84.     call drawbox(0.3)
  85.     call drawsine(0.3)
  86.  
  87.     call getkey
  88.  
  89.     return
  90.     end
  91.  
  92.     subroutine drawbox(s)
  93.     real    s
  94.  
  95.     call pushmatrix
  96.  
  97.     call rotate(30.0, 'x')
  98.     call rotate(60.0, 'y')
  99.     call translate(-0.7, -1.2, 0.0)
  100.     call scale(s, s, s)
  101.  
  102.     call move(0.0, 0.0, 0.0)
  103.  
  104.     call draw(1.0, 0.0, 0.0)
  105.     call draw(1.0, 1.0, 0.0)
  106.     call draw(0.0, 1.0, 0.0)
  107.     call draw(0.0, 0.0, 0.0)
  108.  
  109.     call draw(0.0, 0.0, -1.0)
  110.     call draw(1.0, 0.0, -1.0)
  111.     call draw(1.0, 1.0, -1.0)
  112.     call draw(0.0, 1.0, -1.0)
  113.     call draw(0.0, 0.0, -1.0)
  114.  
  115.     call move(0.0, 1.0, -1.0)
  116.     call draw(0.0, 1.0, 0.0)
  117.  
  118.     call move(1.0, 1.0, 0.0)
  119.     call draw(1.0, 1.0, -1.0)
  120.  
  121.     call move(1.0, 0.0, 0.0)
  122.     call draw(1.0, 0.0, -1.0)
  123.  
  124.     call popmatrix
  125.  
  126.     return
  127.     end
  128.  
  129.     subroutine drawsine(s)
  130.     real    s, RAD, AMP
  131.     parameter(RAD = 0.5, AMP = 0.04)
  132.  
  133.     real    a, x, y, z
  134.  
  135.     call pushmatrix
  136.  
  137.     call translate(RAD + 0.2, -0.5, 0.0)
  138.     call scale(s, s, s)
  139.  
  140.     call move(RAD, 0.0, 0.0)
  141.     do 10  a = 0.0, 2 * 3.1415926, 0.02
  142.         x = RAD * cos(a)
  143.         z = RAD * sin(a)
  144.         y = AMP * sin(a * 6.0)
  145.  
  146.         call draw(x, y, z)
  147. 10    continue
  148.     call popmatrix
  149.  
  150.     return
  151.     end
  152.