MedicalVisualization

3D Texturing Example

3D Texture Parameters | | 3D Texture Example with LGL

3D texture is supposed to be given as texture object with id texid.

// global settings
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
glEnable(GL_TEXTURE_3D);

// bind specific texture
glBindTexture(GL_TEXTURE_3D,texid);

// transfrom texture into world coordinates
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslated(0.5,0.5,0.5);
glMatrixMode(GL_MODELVIEW);

// render textured geometry
glColor3f(1,1,1);
glBegin(GL_QUADS);
   glTexCoord3f(x_0,y_0,z_0);
   glVertex3d(x_0,y_0,z_0);
   glTexCoord3f(x_1,y_1,z_1);
   glVertex3d(x_1,y_1,z_1);
   glTexCoord3f(x_2,y_2,z_2);
   glVertex3d(x_2,y_2,z_2);
   glTexCoord3f(x_3,y_3,z_3);
   glVertex3d(x_3,y_3,z_3);
glEnd();

// unbind texture
glBindTexture(GL_TEXTURE_3D,0);
glDisable(GL_TEXTURE_3D);


3D Texture Parameters | | 3D Texture Example with LGL

Options: