Volume File Format ------------------ struct VolumeHeader { char magic[4]; int version; char texName[256]; bool wrap; int volSize; int numChannels; int bytesPerChannel; }; The first 4096 bytes of the .vol files contain the header and zero padding to fill the 4096 bytes up. Then follows an array of volSize*volSize*volSize*numChannels*bytesPerChannel bytes containing the actual volume data. The header elements are: magic: should be "VOLU" version: should be 4 texName: the name of the texture wrap: is the texture tileable? volSize: side length of the teture numChannels: e.g. 3 for RGB bytesPerChannel: 1 for bytes, 4 for float The header can be read in C/C++ as follows: FILE * fin = fopen("volume.vol", "wb"); char buf[4096]; fread(buf, 4096, 1, fin); VolumeHeader * header = (VolumeHeader *)buf; if ((header->magic[0] != 'V') || (header->magic[1] != 'O') || (header->magic[2] != 'L') || (header->magic[3] != 'U')) error("bad header: invalid magic"); if (header->version != 4) error("bad header: version != 4"); if (header->bytesPerChannel != 1) error("bad header: only byte textures supported"); int volBytes = header->volSize*header->volSize*header->volSize*header->numChannels; unsigned char * data = new unsigned char[volBytes]; fread(data, volBytes, 1, fin); fclose(fin);