Horde3D
http://horde3d.org/forums/

h3dutCreateTGAImage - directional confusion?
http://horde3d.org/forums/viewtopic.php?f=3&t=1122
Page 1 of 1

Author:  fkdesign [ 13.03.2010, 17:21 ]
Post subject:  h3dutCreateTGAImage - directional confusion?

Code:
#include <cstdio>
#include <Horde3DUtils.h>

int main() {
    unsigned char pixels[] = { 255, 255, 255,       128, 128, 128,     0, 0, 0,
                               0, 0, 255,           0, 255, 0,         255, 0, 0,
                               100, 100, 0,         0, 100, 0,         0, 100, 100
                             };
    char *out_data;
    int out_size;
    h3dutCreateTGAImage(pixels, 3, 3, 24, &out_data, &out_size);
    FILE *f = fopen("test.tga", "wb");
    fwrite(out_data, 1, out_size, f);
    fclose(f);
    return 0;
}


According to the documentation, that pixel data should produce a 3x3 image where the upper left pixel is white (the origin) etc. However, see the attachment for the actual output; it seems as if the code actually took the lower left corner as the origin. No idea if the code or the documentation is right, but I'd say one of them needs to be fixed.

Regards,
Felix

Attachments:
File comment: Programme output (converted to PNG and scaled up so you can actually find it)
test.png
test.png [ 291 Bytes | Viewed 6118 times ]

Author:  marciano [ 19.03.2010, 02:47 ]
Post subject:  Re: h3dutCreateTGAImage - directional confusion?

Thanks for the hint.

I guess we should fix the documentation as all other texture and image related functions assume the origin to be the lower left corner.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/