View Full Version : printing with OpenGL and MFC?
Anybody knows a tutorial about printing with OpenGL and MFC?
04-29-2001, 12:03 AM
What do you want to print?
I have an aplication created with OpenGL and Visual C++(using MFC), and I need to print the client area that contains a OpenGL's scene.
My knowoldge of OpenGL and MFC ( and about Enghlish, too. Sorry¿))is very little. Thus I´m looking for a exemple of printing.
Opps I have to say another thing¡¡
I have seen that exists problems printing in Windows NT ( the implementation of Opengl in W' NT don't suports printing ) and I need printing in all windows versions.
I've readed that a solution is(http://support.microsoft.com/support/kb/articles/Q132/8/66.asp):
Create a printer device context.
Create a memory device context.
Create a bitmap that can be either a DIB section or a screen compatible bitmap, and select it into the memory device context. This bitmap must have four or more bits of color information per pixel.
Set the pixel format of the memory device context.
Create a rendering context, passing the wglCreateContext function the handle to the memory device context, and make that rendering context a thread's current rendering context.
Make OpenGL calls, which will draw into that rendering context.
Disconnect and delete the rendering context.
Use StretchDIBits, SetDIBitsToDevice, StretchBlt, or BitBlt from the memory device context to the printer device context.
Delete the bitmap, the memory device context, and the printer device context.
But, How I do all of this things? Do you know a function for Visual C++(MFC) that makes it?
04-29-2001, 01:27 PM
<sarcasm> Yes, of course. There is one simple function that will perform a complex task like creating multiple device contexts, a rendering context, drawing your scene, and sending it to the printer. Why wouldn't there be? </sarcasm>
No, sorry, there is no simple function that will print an OpenGL scene. You will have to do what you described. But, that isn't really hard, so I don't see what the problem is.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.