Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Printing an OpenGL image in a Carbon app - can it be done?



I am trying to develop an OpenGL-based application that will run in Classic mode. The reason for this is that I hope to interest secondary-school teachers, and many of them, I believe, are hanging on to their OS-9 computers.

As I understand it, the best way to write a classic application is to use Metrowerks Codewarrior, which is what I have done. I have got the application to where it will do most of its jobs in Classic mode, but I have not figured out how to print.

Printing OpenGL images on Apple computers requires some tricks. In 2002, Troy Stephens wrote (on this list)
The standard AppKit printing mechanism works by simply redirecting Quartz drawing, so printing of OpenGL views isn't automatically supported. What you can do, however, is grab a snapshot of your NSOpenGLView's contents as a bitmap by using glReadPixels() to read from the framebuffer. You can then print the resultant bitmapped image.

I was able to make that work in the Cocoa-based version. But in the Carbon-based version, I am getting a blank page.

I have put a simplified app on http://mathinteract.com/OpenGLDemo.dmg. The troublesome code is in DemoPane::PrintPanelSelf(). I would welcome any suggestions on how to make this work.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.