PDA

View Full Version : why i write tiff file left and right reversed



leeriver
11-05-2005, 05:32 PM
I use tifflib LibTIFF TIFF Library
My GL effect anticlockwise ,but render tiff file is widdershins.I render tga file is well!
Any suggestions? Thanks in advance.

code:

glReadBuffer(GL_BACK);
glReadPixels(0, 0, _width, _height, GL_RGBA, GL_UNSIGNED_BYTE, data);
...
TIFFWriteEncodedStrip(tif, 0, raster, _width * _height *4);

Azdo
11-09-2005, 02:07 AM
Maybe the TIFF library coordinates are different from OpenGL's. OpenGL texture coordinates have their origin at the bottom left of the image. The majority of the image file formats have their origin at upper left corner of the image. You can solve this by yourself moving the pixels of the image or scaling the OpenGL texture transformation matrix by a factor of -1 in the X axis.

leeriver
11-09-2005, 08:58 PM
yourself moving the pixels of the image[/QB]Thanks Azdo! suggest very useful!