volmetrics
diff src/main.cc @ 34:eb87d4a12bd3
histogram
author | Eleni Maria Stea <elene.mst@gmail.com> |
---|---|
date | Mon, 18 Aug 2014 10:44:11 +0300 |
parents | 3e4eb9a0d999 |
children | df4a277adb82 |
line diff
1.1 --- a/src/main.cc Sun Aug 17 02:25:01 2014 +0300 1.2 +++ b/src/main.cc Mon Aug 18 10:44:11 2014 +0300 1.3 @@ -468,6 +468,23 @@ 1.4 high = thres; 1.5 } 1.6 1.7 + 1.8 + //drawing the histogram 1.9 + float hmax = 1 / (float)vol->max_histogram_value; 1.10 + 1.11 + glBegin(GL_QUADS); 1.12 + for (int i=0; i<HIST_SIZE; i++) { 1.13 + float x0 = (float)i / HIST_SIZE; 1.14 + float x1 = (float)(i + 1) / HIST_SIZE; 1.15 + 1.16 + glColor3f(0.3, 0.3, 0.3); 1.17 + glVertex3f(x0, 0, 0); 1.18 + glVertex3f(x1, 0, 0); 1.19 + glVertex3f(x1, hmax * vol->histogram[i + 1], 0); 1.20 + glVertex3f(x0, hmax * vol->histogram[i], 0); 1.21 + } 1.22 + glEnd(); 1.23 + 1.24 //drawing the transfer function curve 1.25 1.26 glLineWidth(3);