Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
cubo rotante - cube5b.f90

cube5b.f90

Caricato da:
Scarica il programma completo

  1. subroutine CreateDisplayList ()
  2. use msfwin
  3. use opengl
  4. use cubeinc
  5. real(4) glfMaterialColor(4)
  6. data glfMaterialColor / 0.0, 0.0, 1.0, 1.0 /
  7.  
  8.     call fglNewList (DRAWCUBE, GL_COMPILE)
  9.     call fglMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, LOC(glfMaterialColor))
  10.  
  11.     call fglBegin(GL_POLYGON)              
  12.         call fglNormal3f (0.0, 0.0, 1.0)        
  13.         call fglVertex3f(1.0, 1.0, 1.0)
  14.         call fglVertex3f(-1.0, 1.0, 1.0)
  15.         call fglVertex3f(-1.0, -1.0, 1.0)
  16.         call fglVertex3f(1.0, -1.0, 1.0)
  17.     call fglEnd()
  18.  
  19.     call fglBegin(GL_POLYGON)              
  20.         call fglNormal3f (0.0, 0.0, -1.0)
  21.         call fglVertex3f(1.0, 1.0, -1.0)
  22.         call fglVertex3f(1.0, -1.0, -1.0)
  23.         call fglVertex3f(-1.0, -1.0, -1.0)
  24.         call fglVertex3f(-1.0, 1.0, -1.0)
  25.     call fglEnd()
  26.  
  27.     call fglBegin(GL_POLYGON)              
  28.         call fglNormal3f (-1.0, 0.0, 0.0)          
  29.         call fglVertex3f(-1.0, 1.0, 1.0)
  30.         call fglVertex3f(-1.0, 1.0, -1.0)
  31.         call fglVertex3f(-1.0, -1.0, -1.0)
  32.         call fglVertex3f(-1.0, -1.0, 1.0)
  33.     call fglEnd()
  34.  
  35.     call fglBegin(GL_POLYGON)              
  36.         call fglNormal3f (1.0, 0.0, 0.0)
  37.         call fglVertex3f(1.0, 1.0, 1.0)
  38.         call fglVertex3f(1.0, -1.0, 1.0)
  39.         call fglVertex3f(1.0, -1.0, -1.0)
  40.         call fglVertex3f(1.0, 1.0, -1.0)
  41.     call fglEnd()
  42.  
  43.     call fglBegin(GL_POLYGON)              
  44.         call fglNormal3f (0.0, 1.0, 0.0)            
  45.         call fglVertex3f(-1.0, 1.0, -1.0)
  46.         call fglVertex3f(-1.0, 1.0, 1.0)
  47.         call fglVertex3f(1.0, 1.0, 1.0)
  48.         call fglVertex3f(1.0, 1.0, -1.0)
  49.     call fglEnd()
  50.  
  51.     call fglBegin(GL_POLYGON)              
  52.         call fglNormal3f (0.0, -1.0, 0.0)
  53.         call fglVertex3f(-1.0, -1.0, -1.0)
  54.         call fglVertex3f(1.0, -1.0, -1.0)
  55.         call fglVertex3f(1.0, -1.0, 1.0)
  56.         call fglVertex3f(-1.0, -1.0, 1.0)
  57.     call fglEnd()
  58.  
  59. call fglEndList ()
  60. end
  61.  
  62.  
  63.  
  64.  
  65. subroutine DrawScene (hdc, nAngle)
  66. !MS$  ATTRIBUTES VALUE :: hdc
  67. !MS$  ATTRIBUTES VALUE :: nAngle
  68. use msfwin
  69. use opengl
  70. use cubeinc
  71. integer(4)  hdc, nAngle
  72. integer i, j, k
  73. logical(4)  bret
  74.  
  75.    
  76.     call fglClear(IOR(GL_COLOR_BUFFER_BIT , GL_DEPTH_BUFFER_BIT))
  77.  
  78.    
  79.  
  80.     call fglMatrixMode(GL_MODELVIEW)
  81.     call fglLoadIdentity()
  82.     call fglTranslatef(0.0, 0.0, -32.0)
  83.     call fglRotatef(50.0, 1.0, 0.0, 0.0)
  84.     call fglRotatef(REAL(nAngle), 0.0, 1.0, 0.0)
  85.  
  86.    
  87.     do i = -3, 3, 3
  88.         do j = -3, 3, 3
  89.             do k = -3, 3, 3
  90.                 call fglPushMatrix ()
  91.                 call fglTranslatef (REAL(i), REAL(j), REAL(k))
  92.                 call fglCallList (DRAWCUBE)
  93.                 call fglPopMatrix ()
  94.             end do
  95.         end do
  96.     end do
  97.  
  98.    
  99.     bret = SwapBuffers(hdc)
  100. end