Has anyone out there had any luck at printing using OpenGl and
MFC? If so would you kindly assist me in attempting the same.
This is an urgent requirement, so I would be very grateful for
any assistence offered.
--
Martin J. Bysh
Has anyone out there had any luck at printing using OpenGl and
MFC? If so would you kindly assist me in attempting the same.
This is an urgent requirement, so I would be very grateful for
any assistence offered.
--
Martin J. Bysh
I've just written the code for the printing module of a CAD software usingQuote:>Has anyone out there had any luck at printing using OpenGl and
>MFC? If so would you kindly assist me in attempting the same.
First of all, I've never succeded in using the metafile technique described
in Microsoft's documentation...
I do the rendering into a DIB section attached to a memory device context
(with the PFD_DRAW_TO_BITMAP flag for SetPixelFormat()). I use a 24-bpp DIB
for it gives the best results.
The problem is that the resolution of a printer is far superior to that of a
screen. With 600 dpi, you would need hundreds of millions of pixels, which
is just too much for OpenGL (i.e. wglCreateContext() will fail).
So I cut the rendering into stripes with a height such that width *
stripe_height < 1 million (for example).
For each stripe, set the partial viewport with glViewport() and the partial
window with glOrtho() / glFrustum(), and render the scene (with a good view
culling, it's not too costly). Then blt the DIB at the good place into the
printer device context using StretchBlt(). The printer driver will handle
the dithering...
I've tested this method on a black&white HP laser printer and on a color
inkjet printer, and it works fine. Good luck!
Olivier.
1. Printing using OpenGL and MFC in Windows95
I am attempting to print my scene using OpenGL and the MFC. In the Windows
help, I found a reference to Printing an OpenGL Image, which infoms me that
I have to create a metafile DC, set this as the rendering context using
wglCreateContext, then render with OpenGL, and that's that. However, I
cannot get any of this to work. Whatever I have tried, the HGLRC passed
back from wglCreateContext is always NULL.
Has anyone acheived printing using OpenGL and the MFC (or simply just OpenGL
and Win32). If so, could you please give me some idea of what to do, or
perhaps some sample source code.
Any help would be appreciated.
Olly.
4. News About International Contest of Computer Graphics Immaginando 97
5. Need Help on Using OpenGL in MFC.
6. Optical Motion Capture Studio
7. Printing OpenGL in Windows/MFC
10. opengl crash on nt2000 VC 6.0 MFC MDI app using spliiterWnds
11. make opengl work with mfc using a single document
12. making opengl work with mfc (sdi - not using document/view )