Printing openglwindow

Printing openglwindow

Hi!
I have a problem, and I am in desperate need of help. I have written a program in a windows-project, and I have used opengl to plot some graphs. Now, I would like to add the option to print the contents of the opengl-window to a printer. But I can't get it to work. No matter what I do, the page prints out blank.
Has anyone else had this problem, and has someone any idea how to do?

Thank you for any help.

Jenny

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Most printer device contexts don't support OpenGL. You'll need to create a bitmap, render your OpenGL graph to the bitmap, and then print the bitmap.

Alternatively, you can look into creating an enhanced metafile with embedded OpenGL calls and then print the metafile, but I believe this doesn't work under Win98/Me. There's an article on this at: http://www.starstonesoftware.com/OpenGL/metafile.htm.

The non-programattic solution is to just do an Alt-Print Screen and then paste from the clipboard to MS Paint and print from there. But that is not very satisfactory if you are creating a commerical product.

Hope this helps!

John

Thank you very much for your answer! I work with windows 2000, does the metafile approach work then? I have already tried this, I made a enhanced metafile from the window handle, but I never managed to send it to the printer correctly.
I will try writing to a bitmap. I will be back to let you know how it went.
/ Jenny

I haven't tried translating Steve's metafile approach to Fortran, but printing using his sample C++ application worked on my Windows 2000 system.

Let us know how the bitmap printing works out.

John

Leave a Comment

Please sign in to add a comment. Not a member? Join today