Advertisement

opengl + texture mapping + jpg

Started by March 03, 2004 12:07 PM
1 comment, last by monkey man 21 years ago
I''m writing a piece of code that renders a model, mds file, and I''m having problems with the texture mapping. The texture''s are jpg''s but I believe the uv coords are set for tga textures. Now I read somewhere that jpg data is stored backwards or inverted compared to bitmaps. Is this also truc for jpg and tga files? Any suggestions? All of my polygons are triangles, should I try rendering the vertex''s in the current order but the uv coords the other way around. Suggestions would be greatly appreciated.
I don''t think it''s the other way round for any image type, but I dunno for sure. Try it and see! If you need to flip it around, just use (1-u) or (1-v).

You may be getting it confused with different 3D formats, e.g. MS3D uses different axes to OGL (y is inverted IIRC), so textures are flipped. You can either save the mirrored texture or invert the co-ordinates as you load them in. (Quicker to invert once when loading than do it every frame!)

Hope that helps.
Advertisement
I think you do have to flip the jpg data, but not sure.

Load the texture in one format...tga or bmp or whatever and just map it to a quad. Then load the jpg and map the same to the quad. See if it flips or anything.



"That''s a very nice hat."
-Korben Dallas
"That's a very nice hat."-Korben Dallas

This topic is closed to new replies.

Advertisement