Re: Printing an NSOpenGLView
Re: Printing an NSOpenGLView
- Subject: Re: Printing an NSOpenGLView
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Thu, 25 Aug 2005 10:19:51 +0200
On 25.08.2005, at 06:32, Michael Clark wrote:
On 20-Aug-05, at 7:38 PM, Gerriet M. Denkmann wrote:
1. question: How does the drawRect: method know that it is printing?
Obviously in this case it must do something completely different.
You can check this: [[NSGraphicsContext currentContext]
isDrawingToScreen]
Thanks. This I was looking for (only looking at the wrong place).
2. question: What should the drawRect: do when it has figured out it
is printing?
In the Open-Gl list archives I found a solution:
0. Do not print the NSOpenGLView but:
1. Make an NSBitmapImageRep of correct size.
2. [[glView openGLContext ] makeCurrentContext];
3. glReadPixels(..., [imageRep bitmapData]);
4. Make an NSImage with this imageRep
5. Make an NSImageView with this image
6. Print this NSImageView instead.
This works - sort of. Areas with low opaqueness are often displayed in
wrong, gaudy colours.
I asked the opengl-list about this, but got no answer so far.
Maybe somebody here has an idea what I am doing wrong?
I have a very small project which I could mail to anybody interested in
checking this out.
Kind regards,
Gerriet.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden