I am experimenting with C++ code to load a png file, using libpng. When I get to the color data in the file, I load it into a
std::vector. I have found that the interface between the C code libpng and my C++ code is straightforward.
I then draw the image using OpenGL.
When the image file is opened in GIMP, it displays as,
When I display the image with my OpenGL code it displays as,
The file I am using is an RGBA image without a backround, i.e., no kBKG chunk.
In looking at the pixel data in my
std::vector, it appears that the OpenGL data for the lower right is all RGBA = (0, 0, 0, 0).
I was expecting that the png IDAT chunk would carry and display the transparency information.
In OpenGL I am setting the background to RGBA = (1, 1, 1, 1), i.e., in 8-bit RGBA terms (255, 255, 255, 255), white.
I am obviously missing something, but cannot see what it might be.