Sharing Lists between Display RC and Printer RC ???

Hi,

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:
PFD_DRAW_TO_WINDOW
PFD_SUPPORT_OPENGL
PFD_DOUBLEBUFFER
and the PixelFormat of the Printer RC has these flags:
PFD_DRAW_TO_BITMAP
PFD_SUPPORT_OPENGL
PFD_STEREO_DONTCARE

I have read that to share Call Lists, Pixel Formats must be the same.

Has anyone a solution ?

Best regards.

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;
void *DIBits;
int PrinterWidth,PrinterHeight;
int BitmapWidth,BitmapHeight;

PrinterWidth=pInfo->m_rectDraw.Width();
PrinterHeight=pInfo->m_rectDraw.Height();
BitmapWidth=pInfo->m_rectDraw.Width()/4;
BitmapHeight=pInfo->m_rectDraw.Height()/4;

EnterPictureMode(BitmapWidth,BitmapHeight);
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;
DIBits=SnapPicture();
StretchDIBits(pDC->GetSafeHdc(),0,0,PrinterWidth,PrinterHeight,0,0,BitmapWidth,BitmapHeight,DIBits,myBitmapInfo,DIB_RGB_COLORS,SRCCOPY);
ExitPictureMode();

The EnterPictureMode/ExitPictureMode create my offscreen DC and the SnapPicture does the snapshot…

Regards.

Eric

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. :wink:

Best regards