PDA

View Full Version : texture matrix and texture coordinate



hwj_just
05-10-2005, 12:02 AM
hi i want to know when we use texture matrix like this
glMatrixMode(GL_TEXTURE);
glRotate........
glMatrixMode(GL_MODEVIEW);
...........

do i change the coordinate of the texture? if yes ,how to give the same texture coordinates at geometry vertices no matter what the orientation and the texture matrix does the rotation? in another words i want to draw a stack of parallel planes parallen to the screen to form the image in volume rendering using 3d texture?

T101
05-10-2005, 02:02 AM
If you don't want the texture matrix to modify your texture coordinates, just push the matrix, load it with an identity matrix, send your "literal texture coordinates", then pop the matrix.

Or, maybe even better: don't draw the unmodified texture coordinates in the same loop as the modified ones. That should save you a lot of matrix operations.
But if you want correct looking transparency and can't live with additive blending for the grid, you'll have to render back to front and modify the matrix for every layer rendered.

hwj_just
05-10-2005, 03:19 AM
do you means that before the popmatrix i do the mapping like this:
glMatrixMode[GL_TEXTURE]
glPushMatrix[];
glLoadIdentity[];
glBegin[...];
glVertex[....];
glTexcord[...];
......
glEnd[];
glPopMatrix();
glTranslate[...];
...
glMatrixMode[GL_MODELVIEW];
...
i want to get a cube , no matter the orientation or he texture matrix does rotation ,the cube will be rendered from back to front of a stack of plane parallel the screen. but can see the change of texture in side.do i do the right?