subroutine output(x,y,s) use opengl_gl use opengl_glut implicit none real, intent(in) :: x,y character, intent(in) :: s*(*) character(len=1) :: c integer :: i,lenc call glrasterpos2f(x,y) lenc = len(s) do i=1,lenc c = s(i:i) call glutbitmapcharacter(GLUT_BITMAP_TIMES_ROMAN_24, & ichar(c)) end do return end subroutine output subroutine display() use opengl_gl interface subroutine output(x, y, s) implicit none real, intent(in) :: x,y character, intent(in) :: s*(*) end subroutine output end interface call glclear(GL_COLOR_BUFFER_BIT) call output(0.0,24.0, & 'This is written in a GLUT bitmap font.') call output(100.0,100.0,'ABCDEFGabcdefg') call output(50.0,145.0, & '(positioned in pixels with upper-left origin)') call glflush() return end subroutine display subroutine reshape(w,h) use opengl_gl use opengl_glu implicit none integer, intent(in) :: w, h call glviewport(0, 0, w, h) call glmatrixmode(GL_PROJECTION) call glloadidentity() call gluortho2d(dble(0.0), dble(w), dble(0.0), dble(h)) call glscalef(1.0, -1.0, 1.0) call gltranslatef(real(0.0), real(-h), real(0.0)) call glmatrixmode(GL_MODELVIEW) return end subroutine reshape program main use opengl_glut use opengl_gl implicit none integer :: win interface subroutine reshape(w, h) implicit none integer, intent(in) :: w, h end subroutine reshape subroutine display() end subroutine display end interface call glutinitdisplaymode(GLUT_RGB + GLUT_SINGLE) call glutinitwindowsize(500, 150) call glutinit() win = glutcreatewindow('Fortran GLUT bitmap A') call glclearcolor(0.0, 0.0, 0.0, 1.0) call glutdisplayfunc(display) call glutreshapefunc(reshape) call glutmainloop() stop end program main