- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Anyone have a code snippet that prints a window drawn with OpenGL? I recall something about early OpenGL not being able to print to B&W ie LJ printers! Is this still true? Thanks for any input, Bruce
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Attached is the workspace I helped Myron McKenzie with recently (it evolved from a publicly available example, which you can find here, so I guess it's OK to post it).
Frankly, I don't recall the very details; I added OpenGLToBitmap() routine, which converts the active OpenGL surface to bitmap handle. After that, printing is done just by StretchBlt-ing it to a printer DC.
Here's a copy&paste of my message to Myron:
Attached are fixed & tested versions of source files. I had, um, slight problems getting them to build (I filled the missing parts from http://perso.wanadoo.fr/perois/f95gl.html, probably the
same location as you). As expected, I mistranslated that loop. Further, I was using the wrong API -- it should be CreateDIBitmap, not CreateDIBSection. The stuff prints OK (I have only a 300 DPI B&W printer at hand and StretchBlt version is totally black, but BitBlt is fine, so I suppose it'll be OK). I inserted a call to
Sleep() -- you can remove it. Commented out in PrintDIBitmap.f90 are calls to XSaveBitmap, in case you need to save it to a bmp file.
D'oh, the attachment won't stick. Please drop me an e-mail privately. (See my profile).
Jugoslav
Frankly, I don't recall the very details; I added OpenGLToBitmap() routine, which converts the active OpenGL surface to bitmap handle. After that, printing is done just by StretchBlt-ing it to a printer DC.
Here's a copy&paste of my message to Myron:
Attached are fixed & tested versions of source files. I had, um, slight problems getting them to build (I filled the missing parts from http://perso.wanadoo.fr/perois/f95gl.html, probably the
same location as you). As expected, I mistranslated that loop. Further, I was using the wrong API -- it should be CreateDIBitmap, not CreateDIBSection. The stuff prints OK (I have only a 300 DPI B&W printer at hand and StretchBlt version is totally black, but BitBlt is fine, so I suppose it'll be OK). I inserted a call to
Sleep() -- you can remove it. Commented out in PrintDIBitmap.f90 are calls to XSaveBitmap, in case you need to save it to a bmp file.
D'oh, the attachment won't stick. Please drop me an e-mail privately. (See my profile).
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page