c ===============================
        subroutine risi_nihalo
        include 'GL/fgl.h'
        include 'GL/fglut.h'

        real pi, x, y, z, A, dolzina_vzmeti, omega
        real cas_sekunde
        common/cas/ cas_sekunde
        data pi/3.14159/, A/0.5/

        omega=1000.0*3.14159/180.0
        dolzina_vzmeti = 1.8 + A*cos(omega*cas_sekunde)

        call fglDisable(GL_LIGHTING)
        call fglBegin(GL_LINE_STRIP)
        do 10 i=0, 360*5, 5
          x = 0.2*cos(pi*i/180.0)
          y = 0.2*sin(pi*i/180.0)
          z = i*0.001*dolzina_vzmeti/1.8
          call fglVertex3f(x, y, z)
10      continue
        call fglEnd()
        call fglEnable(GL_LIGHTING)
        call fglTranslatef(0.0, 0.0, dolzina_vzmeti)
        call fglutSolidSphere(0.3D0, 10, 10)

        end
c ===============================
	subroutine risi
        include 'GL/fgl.h'
        include 'GL/fglut.h' 

	call fglClear(GL_COLOR_BUFFER_BIT+GL_DEPTH_BUFFER_BIT)
	call fglColor3f(1.0, 0.4, 1.0)

	call fglLoadIdentity
        call fglRotatef(30.0, 1.0, 0.0, 0.0)
        call fglRotatef(30.0, 0.0, 1.0, 0.0)
        call fglTranslatef(0.0, 0.0, -1.0)

        call risi_nihalo

        call fglutSwapBuffers
	return
	end
c ===============================
        subroutine inicializiraj_gl
        include 'GL/fgl.h'

	call fglEnable(GL_LIGHTING)
	call fglEnable(GL_LIGHT0)
	call fglEnable(GL_DEPTH_TEST)
	call fglEnable(GL_COLOR_MATERIAL)
        call fglLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE)
        call fglMatrixMode(GL_PROJECTION)
        call fglLoadIdentity
        call fglOrtho(-1.D0,1.D0, -1.D0,1.D0, -1.D0,1.D0)
        call fglMatrixMode(GL_MODELVIEW)
        call fglLoadIdentity

        end
c =========================================================
        subroutine povecaj_cas(nepomembna)
        include 'GL/fglut.h'
c        external povecaj_cas
        real cas_sekunde
        common/cas/ cas_sekunde
        cas_sekunde = cas_sekunde + 0.01
        call fglutPostRedisplay()
        call fglutTimerFunc(10, povecaj_cas, 0)
        end
c =========================================================
	program glavni
        include 'GL/fglut.h' 
	external risi
	external povecaj_cas

        integer moje_okno

	call fglutInit
        call fglutInitWindowSize(500, 500)
        call fglutInitDisplayMode(GLUT_DOUBLE+GLUT_DEPTH)
        moje_okno = fglutCreateWindow('risi_miska')

        call inicializiraj_gl

	call fglutDisplayFunc(risi)
        call fglutTimerFunc(2000, povecaj_cas, 0)

	call fglutMainLoop

	stop
	end	


		
