ssloy/tinyrenderer

flip_vertically results in black image when there are vertical lines

berkowitze opened this issue · 1 comments

Cloning any of the reference codes for lesson 1 (for example here) and adding in a vertical line results in the output image being black, unless you remove the flip_vertically() call.

int main(int argc, char** argv) {
    TGAImage image(100, 100, TGAImage::RGB);

    line(60, 40, 60, 20, image, TGAColor(255, 100, 100, 255));
    // with this line, black image. without, things work fine
    image.flip_vertically(); // i want to have the origin at the left bottom corner of the image
    image.write_tga_file("output.tga");
    return 0;
}

Curious if other people can repro. I'm on a Mac, if that makes any difference.

Not sure how to reproduce. But this is really stale code. Can you try the latest version?