I have a simple 3d cube (all sides equal size) and a 3D texture in OpenGL. I want to map the 3D texture to the cube.
The result should be a cube which is colored all the way through such that every point inside the cube gets the color from a corresponding point inside texture. This is at least my interpretation of a 3D texture.
How to do this? I suppose it will not work to make a cube with GL_QUADS (6 quads) and specifying one texture coordinate for each of the six sides?
I assume I have to make a cube and while making the cubing specifying glTexCoord in the correct way.
What you are describing sounds like voxel rendering, typically done with raytracing.
3D textures unfortunately don't do what you describe. Though a 3D texture takes U,V,W for each texel fetch, OpenGL still draws along the flat surfaces of the primitives. You will have to write some raytracing code in your fragment shader to cast into your 3D texture. Since you'd be effectively raytracing, you'd might as well just place a flat (non-rotated) single quad (better yet, two triangles making a pseudo-quad since quads are deprecated) and write fragment shader code with your raytracing stuff.
For more details look up 'direct volume rendering.'