Mapping 3D float intensity values on a cube

Hi,

I have a 3D matrix of floating point intensity values that I want to map on a cube in order to render them on my screen, and apply rotations, translations, using MIP projection. From what I have seen in tutorials, I got the following code (in Python):

Another problem came from the fact that I was using textures of the size 256x256x64. By making the texture 256x256x256 (padding with zeros), the volume was only rendered once.

That suggests that you're reading the data incorrectly.

If you're using the data to texture a cube, using any form of 3D texture is overkill, as only the edges at the boundaries will be used. You'd be better off extracting the faces into 6 2D textures: 2 256x256 textures and 4 256x64 textures = 192k texels, as opposed to 256x256x64 = 4096k texels.

If you're actually trying to render voxel data (it looks like an MRI scan or similar), you shouldn't be rendering a cube, but e.g. rendering 64 parallel squares using additive blending.