MedicalVisualization
3D Texture Slice
← Texture Coordinate Generation | ● | 3D Texture Objects →
Usage Example: Drawing a horizontal quad inside a unit volume with vertical position h. The barycenter of the unit volume is specified to be the origin of the world coordinate system.
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslated(0.5,0.5,0.5);
glMatrixMode(GL_MODELVIEW);
glBegin(GL_QUADS);
x_0=-0.5; y_0=h; z_0=-0.5;
glTexCoord3f(x_0,y_0,z_0);
glVertex3d(x_0,y_0,z_0);
x_1=0.5; y_1=h; z_1=-0.5;
glTexCoord3f(x_1,y_1,z_1);
glVertex3d(x_1,y_1,z_1);
x_2=0.5; y_2=h; z_2=0.5;
glTexCoord3f(x_2,y_2,z_2);
glVertex3d(x_2,y_2,z_2);
x_3=-0.5; y_3=h; z_3=0.5;
glTexCoord3f(x_3,y_3,z_3);
glVertex3d(x_3,y_3,z_3);
glEnd();
glLoadIdentity();
glTranslated(0.5,0.5,0.5);
glMatrixMode(GL_MODELVIEW);
glBegin(GL_QUADS);
x_0=-0.5; y_0=h; z_0=-0.5;
glTexCoord3f(x_0,y_0,z_0);
glVertex3d(x_0,y_0,z_0);
x_1=0.5; y_1=h; z_1=-0.5;
glTexCoord3f(x_1,y_1,z_1);
glVertex3d(x_1,y_1,z_1);
x_2=0.5; y_2=h; z_2=0.5;
glTexCoord3f(x_2,y_2,z_2);
glVertex3d(x_2,y_2,z_2);
x_3=-0.5; y_3=h; z_3=0.5;
glTexCoord3f(x_3,y_3,z_3);
glVertex3d(x_3,y_3,z_3);
glEnd();
For h = $-\frac14$, $0$, $+\frac14$ the result looks like this:
Q What can be seen on the slices?