I’m writing a 2D application.
My application is a MDI application.
Each view shares its Call Lists with an unvisible view in the background.
It’s work fine. I have to load only once my ‘object drawing library’ to share it with the other views (scenes in views are not the same).
Now I’m trying to print a view.
All drawings created in ‘Immediate Mode’ are printed but I can’t print the shared display lists.
Because the PixelFormat of the RC of my shared view has these flags:
and the PixelFormat of the Printer RC has these flags:
I have read that to share Call Lists, Pixel Formats must be the same.
Has anyone a solution ?
I am not even sure you can print an OpenGL scene by creating a RC associated with your printer…
What I usually do is render my scene into a DIB and then print it:
BYTE myBufferInfo[sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)];
BITMAPINFO *myBitmapInfo = (BITMAPINFO *) myBufferInfo;
myBitmapInfo->bmiHeader.biSize = sizeof(myBitmapInfo->bmiHeader);
myBitmapInfo->bmiHeader.biWidth = BitmapWidth;
myBitmapInfo->bmiHeader.biHeight = BitmapHeight;
myBitmapInfo->bmiHeader.biPlanes = 1;
myBitmapInfo->bmiHeader.biBitCount = m_PictureParameters.m_iNColorBits;
myBitmapInfo->bmiHeader.biCompression = BI_RGB;
myBitmapInfo->bmiHeader.biSizeImage = BitmapWidthBitmapHeightm_PictureParameters.m_iNColorBits/8;
The EnterPictureMode/ExitPictureMode create my offscreen DC and the SnapPicture does the snapshot…
Thank you for your answer.
I have already implemented these method
that I called ‘Fast Print’.
But the definition is not good enough
for a CAD application.
I’m writing extra code to reload all my scene in a Printer RC. It’s a waste of time for me and waste of resources for the computer.