PDA

View Full Version : Projected texture flipping



gib
01-30-2003, 02:01 PM
When I project a texture from a typical image file (e.g. .bmp, .tga) it appears upside down. Usually when using textures I take care of this in the mapping - no problem. But I can't see any correspondingly simple way to flip the texture when it is being projected. Is there a way to do it, e.g. using the eye planes? I don't want to have to flip all my images in advance, since this could be a real headache, e.g. if I am projecting frames from a video.

thanks
Gib

bakery2k
01-30-2003, 02:10 PM
When you construct the projection matrix, you probably use a scale-bias matrix to convert projected coordinates from [-1, 1] to [0, 1]. e.g.

(0.5, 0.0, 0.0, 0.5,
0.0, 0.5, 0.0, 0.5,
0.0, 0.0, 0.5, 0.5,
0.0, 0.0, 0.0, 1.0)

Change this to flip the images in the Y direction. eg:

(0.5, 0.0, 0.0, 0.5,
0.0,-0.5, 0.0, 0.5,
0.0, 0.0, 0.5, 0.5,
0.0, 0.0, 0.0, 1.0)

gib
01-30-2003, 04:26 PM
Just what I wanted http://www.opengl.org/discussion_boards/ubb/smile.gif

Thanks very much.

Gib