Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Printing openglwindow

jenny_s
Beginner
553 Views
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
0 Kudos
3 Replies
Intel_C_Intel
Employee
553 Views
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
0 Kudos
jenny_s
Beginner
553 Views
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
0 Kudos
Intel_C_Intel
Employee
553 Views
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
0 Kudos
Reply