VolumeRendering

3D Texture Data

3D Texture Objects | | 3D Texture Example

If a 3D texture object has been bound, the data of the texture is uploaded as follows:

glPixelStorei(GL_UNPACK_ALIGNMENT,1);

glTexImage3D(GL_TEXTURE_3D,      // 3D texture
             0,                  // level 0 (for mipmapping)
             GL_INTENSITY,       // pixel format of texture
             width,height,depth, // texture size
             0,                  // border size 0
             GL_LUMINANCE,       // pixel format of data supplied
             GL_UNSIGNED_BYTE,   // pixel storage type of data supplied
             volume);            // pointer to data chunk
pixel formatcomponents
GL_INTENSITY1
GL_RGB3
GL_RGBA4
GL_ALPHA1
GL_LUMINANCE1
GL_LUMINANCE_ALPHA2

The size of a 3D texture is recommended to be a power of 2!

Simple luminance texture volume with a black and a white slice:

unsigned char volume[2*2*2]={0,0,0,0,
                             255,255,255,255};


3D Texture Objects | | 3D Texture Example

Options: