trouble with transparent objects

I am working on MS-Windows OpenGL application that visualize 3D objects. There is an option to “make” object transparent, and it works fine if the object is displayed on the screen.

There is also an option to save the scene to a PNG or BMP file. When I start testing it, I found that on some PCs the transparent object images saved to a file look totally screwed up, but on other everything looks fine!?

The returned value of CreateCompatibleDC(…) is TRUE in bouth cases.

Any idea what can cause such a behavior?

Transparent surfaces are very tricky in 3D graphics. They must be drawn in depth order starting with the polygon thats furthest away from the viewer. Unless you are using BSP or some sort of depth sorting, that’ll be your problem

But the problem occurs only if I’m saving the scene to a file and NOT on all computers. There is no difference in the code if the scene is drawn to the screen or into the memory and later saved as a file. So my first guess was that it can’t create a compatible DC, but in both cases CreateCompatibleDC(…)returns TRUE.

Maybe BPP (bits-per-pixel) of bitmap differs from BPP of DC, which is used in OpenGL? Maybe try glReadPixels?