@@ -142,6 +142,10 @@ subroutine glutBitmapCharacter(font, character) bind(C, name='glutBitmapCharacte
142142 type (c_ptr), value :: font
143143 integer (c_int), value :: character
144144 end subroutine
145+ subroutine glColor4f (r , g , b , a ) bind(C, name= ' glColor4f' )
146+ import :: c_float
147+ real (c_float), value :: r, g, b, a
148+ end subroutine
145149 end interface
146150
147151 ! OpenGL constants
@@ -246,6 +250,7 @@ subroutine glutBitmapCharacter(font, character) bind(C, name='glutBitmapCharacte
246250 print * , " +/- - Increase/Decrease power"
247251 print * , " r/R - Insert positive/negative reactivity"
248252 print * , " c/C - Increase/Decrease coolant flow"
253+ print * , " i/o - Inseart/Withdraw control rods"
249254 print * , " w/s - Rotate up/down"
250255 print * , " a/d - Rotate left/right"
251256 print * , " z/x - Zoom in/out"
@@ -290,7 +295,10 @@ subroutine init_opengl()
290295 call glutReshapeFunc(c_funloc(reshape_callback))
291296 call glutKeyboardFunc(c_funloc(keyboard_callback))
292297 call glutIdleFunc(c_funloc(idle_callback))
293-
298+
299+ call glEnable(GL_BLEND)
300+ call glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
301+
294302 ! OpenGL settings
295303 call glClearColor(0.1_c_float , 0.1_c_float , 0.15_c_float , 1.0_c_float )
296304 call glEnable(GL_DEPTH_TEST)
@@ -374,7 +382,7 @@ subroutine display_callback() bind(C)
374382 z = (real (k, wp) - real (g_sim% nz, wp) / 2.0_wp ) * g_sim% dz
375383
376384 ! Draw voxel
377- call draw_cube(x, y, z, g_sim% dx * 0.4_wp * skip, r, g, b)
385+ call draw_cube(x, y, z, g_sim% dx * 0.4_wp * skip, r, g, b, 0.3_wp )
378386 end do
379387 end do
380388 end do
@@ -514,16 +522,16 @@ subroutine idle_callback() bind(C)
514522 end subroutine idle_callback
515523
516524 ! > Draw a coloured cube
517- subroutine draw_cube (x , y , z , size , r , g , b )
518- real (wp), intent (in ) :: x, y, z, size, r, g, b
525+ subroutine draw_cube (x , y , z , size , r , g , b , alpha )
526+ real (wp), intent (in ) :: x, y, z, size, r, g, b, alpha
519527 real (c_float) :: xf, yf, zf, sf
520528
521529 xf = real (x, c_float)
522530 yf = real (y, c_float)
523531 zf = real (z, c_float)
524532 sf = real (size, c_float)
525533
526- call glColor3f (real (r, c_float), real (g, c_float), real (b, c_float))
534+ call glColo r4 f (real (r, c_float), real (g, c_float), real (b, c_float), real (alpha , c_float))
527535 call glBegin(GL_QUADS)
528536
529537 ! Front
0 commit comments