unsigned char t;
for (int z = 0, y = tgaImageSize-1; z < tgaImageSize; z++, y--)
{
t = tgaImageData[y];
tgaImageData[y] = tgaImageData[z];
tgaImageData[z] = t;
}
It just displays the texture as it looked before I did this.
Any help would be greatly appreciated!
How to inverse the origin of a TGA file (flip it upside down)?
Hello,
I have tried to flip a TGA upside down, but I can''t get it to work.
I essentially do something like this:
From my engine:
It''s not super-optimized, but it works for me. I don''t load too many targas or bitmaps anyway, I use my own image format that has them up right by default.
[Resist Windows XP''s Invasive Production Activation Technology!]
void rRawInfo::FlipVert(void) { rByte *Buffer; unsigned int a, b, c, d; b = Width*BytesPP; c = Height/2; Buffer = (rByte *) malloc(b); for(a=0; a<c; a++) { d = ((Height-1)-a)*b; memcpy(Buffer, &Data[a*b], b); memcpy(&Data[a*b], &Data[d], b); memcpy(&Data[d], Buffer, b); } free(Buffer);}
It''s not super-optimized, but it works for me. I don''t load too many targas or bitmaps anyway, I use my own image format that has them up right by default.
[Resist Windows XP''s Invasive Production Activation Technology!]
What happened to my tabbing? Oh well, you can still read it .
[Resist Windows XP''s Invasive Production Activation Technology!]
[Resist Windows XP''s Invasive Production Activation Technology!]
Wow, never realized how much code from the C-version of my engine was still in the new version, heh. I'll have to replace that malloc with new now . 3 posts in one thread before a response, heh...
[EDIT: I guess you did respond in time ]
[Resist Windows XP's Invasive Production Activation Technology!]
Edited by - Null and Void on October 18, 2001 8:52:44 PM
[EDIT: I guess you did respond in time ]
[Resist Windows XP's Invasive Production Activation Technology!]
Edited by - Null and Void on October 18, 2001 8:52:44 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement