PrintOut of OpenGL-generated 3D-packages doesn't work


I am actually working on a software for container-packing-optimization.
So I have several packages that are stacked in a special position to each other inside a container (“package-heap”). My software calculates the best position for each package in the heap, so that the complete heap (container) has as low volume as possible.
The result that was calculated by the algorithm, must be graphically visualized in 3D.

I have already successfully shown the package-heap-result (result of the position-calculation) by OpenGL on the screen (with Visual C++ 6.0).
Look for Snapshot-Example please at
Now this package-heap should be printed out.

I have found some Sample-Code in the Internet that I have adapted to my problem. This code works.
You can find this code at

Then I embedded this code (the essential files GLObj.cpp and GLObj.h of the Sample) in my main project, while hoping that it would work too there. But it doesn’t work ! The Print-Preview there is at “Drucken-> Druckvorschau Palettenbeladung” (sorry, the program menu is German).

If I click there for the print-preview, there is only an empty paper on the screen. Why ? I have tried a lot, but without success. Please help me.
I need the same package-heap that can be seen on the screen, now in the print-preview.

You can find the “problem code” (that shows only a white paper instead of a correct Print preview at

Could somebody revise the code to solve the problem please ?


Without downloading your code…

Adding this to any windows application requires that you create a rendering context for the 3D drawing.

Printing will require that you read an image and convert it to some kind of resource you can print probably by blitting it using generic GDI rendering calls.