14 #include <QMouseEvent> 26 for (
int i=0;
i<432000;
i++)
53 if (cEvent->buttons() & Qt::LeftButton)
56 rotation = 130 + (cEvent->pos().x()/(float)width())*180.f;
58 else if (cEvent->buttons() & Qt::RightButton)
60 if (cEvent->pos().y() >
height()/2)
73 if (cEvent->buttons() & Qt::LeftButton) {
81 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
84 glTranslatef(-0.0,-0.0, -5);
85 glTranslatef(0,0,(
float)(
transZ));
87 glRotatef((
float)
rotation, 0.0, 1.0, 0.0);
89 glColor3f(1.0,0.0,0.0);
91 glBegin(GL_TRIANGLES);
92 for (
int i=0;
i<1439;
i++)
94 for (
int j=6;j<250;j++)
98 glVertex3f(
_x[
i*300+j],
_y[
i*300+j],
_z[
i*300+j]);
100 glVertex3f(
_x[
i*300+j+1],
_y[
i*300+j+1],
_z[
i*300+j+1]);
102 glVertex3f(
_x[(
i+1)*300+j],
_y[(
i+1)*300+j],
_z[(
i+1)*300+j]);
105 glVertex3f(
_x[
i*300+j+1],
_y[
i*300+j+1],
_z[
i*300+j+1]);
107 glVertex3f(
_x[(
i+1)*300+j+1],
_y[(
i+1)*300+j+1],
_z[(
i+1)*300+j+1]);
109 glVertex3f(
_x[(
i+1)*300+j],
_y[(
i+1)*300+j],
_z[(
i+1)*300+j]);
120 for (
int k=0;k<1440;k++)
121 for (
int j=6;j<251;j++)
129 float span = max - min;
134 for (
int i=0;
i<1440;
i++)
136 for (
int j=6;j<251;j++)
138 _x[
i*300+j] = -1 + (2.f*
i)/1440.f;
139 _y[
i*300+j] = -0.5 + 1.0f*(
_data[
i*300+j] - min)/span;
140 _z[
i*300+j] = -1+(2.f*j)/300.f;
141 float value = (
_data[
i*300 + j] - min)/span;
148 if (value >= 0.33 && value <= 0.66)
151 _colorG[
i*300+j] = (value-0.33)/0.33;
152 _colorB[
i*300+j] = 1 - ((value-0.33)/0.33);
156 _colorR[
i*300+j] = (value-0.66)/0.33;
157 _colorG[
i*300+j] = 1 - ((value-0.66)/0.33);
172 cout <<
"Info : 3D plotter disabled. requires more work so that less than 300 slices per pixel can be loaded" << endl;
173 cout <<
"Contact Etienne (etienne.lyard@unige.ch) for more information." << endl;
189 cout <<
"Info : 3D plotter disabled. requires more work so that less than 300 slices per pixel can be loaded" << endl;
190 cout <<
"Contact Etienne (etienne.lyard@unige.ch) for more information." << endl;
202 glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
204 GLfloat
color[4] = {0.8f, 1.f, 1.f, 1.f};
205 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
206 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 1.0f);
207 gluCylinder( gluNewQuadric(),
213 glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
221 qglClearColor(QColor(25,25,38));
223 glShadeModel(GL_SMOOTH);
224 glEnable(GL_DEPTH_TEST);
225 glDepthFunc(GL_LESS);
226 glDisable(GL_LIGHTING);
230 glDisable(GL_CULL_FACE);
233 glEnable(GL_POLYGON_SMOOTH);
235 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
236 glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
240 glViewport(0,0,cWidth, cHeight);
241 glMatrixMode(GL_PROJECTION);
243 GLfloat windowRatio = (float)cWidth/(
float)cHeight;
247 gluPerspective(40.f, windowRatio, 1, 100);
255 gluPerspective(40.f, windowRatio,1, 8);
261 glMatrixMode(GL_MODELVIEW);