home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / vopl.tar.Z / vopl.tar / vopl / examples / fex1.f < prev    next >
Text File  |  1989-10-04  |  1KB  |  87 lines

  1. c
  2. c    A very simple test program for vopl.
  3. c
  4. c     This one draws a graph of y = sin(x) 0 <= x <= 2*pi
  5. c
  6.     program test1
  7.     parameter (pi = 3.14159265358979)
  8.     parameter (n = 300)
  9.  
  10.     real x(n), y(n)
  11.  
  12.     character device*30
  13. c
  14. c    Get VOGLE device
  15. c
  16.     write(*,'(a,$)') 'Enter VOGLE device: '
  17.     read(*,'(a)') device
  18.  
  19. c
  20. c    Generate the points
  21. c
  22.     t = 0.0
  23.     dt = 2 * pi / n
  24.  
  25.     do 10 i = 1, n
  26.         x(i) = t
  27.         y(i) = sin(t)
  28.         t = t + dt
  29. 10    continue
  30.  
  31. c
  32. c    Adjust the scaling according to x and y arrays
  33. c
  34.     call adjustscale(x, n, 'x')
  35.     call adjustscale(y, n, 'y')
  36. c
  37. c    As we are now about to do some graphics we initialise VOGLE
  38. c    and clear to BLACK
  39. c
  40.     call vinit(device)
  41.     call color(0)
  42.     call clear
  43. c
  44. c    Now set the color to GREEN
  45. c
  46.     call color(2)
  47.  
  48. c
  49. c    Draw the default set of axes (in GREEN)
  50. c
  51.     call drawaxes2
  52. c
  53. c    Set color to RED
  54. c
  55.     call color(1)
  56. c
  57. c    Draw the Graph
  58. c
  59.     call plot2(x, y, n)
  60. c
  61. c    Wait around a bit
  62. c
  63.     call getkey
  64. c
  65. c    Now draw a little one in the top right hand corner
  66. c    by reseting the VOGLE viewport.
  67. c
  68.     call viewport(0.0, 1.0, 0.0, 1.0)
  69. c
  70. c    Draw it again, but do the plot first (in BLUE) then the axes
  71. c    (in YELLOW)
  72. c
  73.     call color(4)
  74.     call plot2(x, y, n)
  75.     call color(3)
  76.     call drawaxes2
  77. c
  78. c    Hang around again
  79. c
  80.     call getkey
  81. c
  82. c    Bugger off...
  83. c
  84.  
  85.     call vexit
  86.     end
  87.