rotate of 3d texture

hello i do the volume rendering via 3d texture.when i rotate texture matrix not only the image rotate but the image position moves.so , the image will be partly out of the viewport .could anyone give me some advice?

Like any coordinate system, texture coordinates rotate about the origin.

Try to translate -0.5 -0.5 -0.5 then rotate then translate +0.5 +0.5 +0.5

For any origin change the 0.5 to whatever you like.

do you mean to glTranslatef(-0.5,-0.5,-0.5) in after glMatrixMode(GL_TEXTURE)?i do but have no effects