c ===============================
        subroutine pretvori_geom_model_v_GL_gradnike

	include 'fgl.h'

        real t(4, 3), n(3)

        common /geometrija/ t, n

        call fglColor3f(1.0, 0.5, 1.0)

        call fglBegin(GL_QUADS)
          call fglNormal3f( n(1),n(2),n(3))
          call fglVertex3f( t(1,1), t(1,2), t(1,3) )
          call fglVertex3f( t(2,1), t(2,2), t(2,3) )
          call fglVertex3f( t(3,1), t(3,2), t(3,3) )
          call fglVertex3f( t(4,1), t(4,2), t(4,3) )
        call fglEnd

        return
        end
c ===============================
	subroutine risi

	include 'fgl.h'
	include 'fglut.h'	

        call fglClear(GL_COLOR_BUFFER_BIT)

	call fglLoadIdentity
        call fglScalef(0.9, 0.9, 0.9)
        call fglRotatef(-30.0, 1.0, 0.0, 0.0)
        call fglRotatef( 30.0, 0.0, 1.0, 0.0)

        call pretvori_geom_model_v_GL_gradnike

        call fglFlush
	return
	end
c ===============================
        subroutine izdelaj_geom_model

        real tocke(4, 3), normala(3)
        common /geometrija/ tocke, normala


        data tocke   / -0.5, 0.5, 0.5,-0.5,
     *                 -0.5,-0.5, 0.5, 0.5,
     *                  0.0, 0.0, 0.0, 0.0 / 
        data normala / 0.0, 0.0, 1.0 /

        return
        end
c ===============================
        subroutine inicializiraj_gl

        include 'fgl.h'

        call fglEnable(GL_LIGHTING)
        call fglEnable(GL_LIGHT0)
        call fglEnable(GL_COLOR_MATERIAL)

        return
        end
c ===============================
	program glavni

	implicit none

	external risi

	include 'fglut.h'	

        integer moje_okno

        call izdelaj_geom_model

	call fglutInit
        call fglutInitWindowSize(500, 500)
        call fglutInitDisplayMode(GLUT_SINGLE)
        moje_okno = fglutCreateWindow('risi_kvadrat_rotiran')

        call inicializiraj_gl

	call fglutDisplayFunc(risi)

	call fglutMainLoop

	stop
	end	


		
