I do Windows programming in C, using Visual C++. Rendering my scene on screen works beautifully, but I can't print at all, and the OpenGL Superbible by R.S.Wright is not quite clear on the subject.
This is the beginning of my printing function (Superbible p. 599):
BOOL GL_PrintLocal(HDC hdc)
HDC hdcImpr;
BITMAPINFO bmapinfo;
HBITMAP bitmap;
GLubyte *bits; // etc
hdcImpr = CreateCompatibleDC (NULL);
memset (&bmapinfo, 0, sizeof (bmapinfo));
bmapinfo.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
bmapinfo.bmiHeader.biWidth = 300;
bmapinfo.bmiHeader.biHeight = 450;
bmapinfo.bmiHeader.biPlanes = 1;
bmapinfo.bmiHeader.biBitCount = BI_RGB;
bitmap = CreateDIBSection (hdcImpr, &bmapinfo, DIB_RGB_COLORS, &bits, NULL, 0);
// etc
At this point, CreateDIBSection returns NULL.
Am I on the wrong track ? Any simple method to have my program produce a hardcopy (no PrintScreen please) ? Thanks.




