invalid CIContext with CGLContext initialization method?
invalid CIContext with CGLContext initialization method?
- Subject: invalid CIContext with CGLContext initialization method?
- From: Cloud Strife <email@hidden>
- Date: Thu, 1 Mar 2007 20:40:35 +0000
Hello,everyone.
I am taking a practice with core image filter, with the guide link:
http://developer.apple.com/documentation/GraphicsImaging/Conceptual/
CoreImaging/index.html?http://developer.apple.com/documentation/
GraphicsImaging/Conceptual/CoreImaging/ci_intro/chapter_1_section_1.html
Please jump to Listing 2-10 :You will find the drawRect method, which
must be implemented by every subclass of the NSView, so far so good.
Please take a notice that the context used for CIImage drawing is
created from the NSGraphicsContext. That's where my problem comes from.
Because we can create the CIContext not only from the
NSGraphicsCotnext, but from the NSOpenglContext,So I modified the
code like this:
NSOpenGLPixelFormatAttribute attr [] = {
NSOpenGLPFAFullScreen,
NSOpenGLPFAAccelerated,
NSOpenGLPFANoRecovery,
NSOpenGLPFAScreenMask,
CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay),
(NSOpenGLPixelFormatAttribute) 0
};
NSOpenGLPixelFormat * myPixFormat = [[NSOpenGLPixelFormat alloc]
initWithAttributes:(void *)&attr];
if (myPixFormat != nil) {
printf("Create a PixelFormat\n");
}else {
return;
}
CIContext * drawCIContext;
drawCIContext = [CIContext contextWithCGLContext:CGLGetCurrentContext()
pixelFormat:[myPixFormat CGLPixelFormatObj]
options:nil ];
instead of these:
drawCIContext = [CIContext contextWithCGContext:
[[NSGraphicsContext currentContext]
graphicsPort]
options: nil];
After I do that , my view doesn't show the CIImage which shows
perfectly with the NSGraphicsContext method. Of course, I don't
understand the mechanism very well, so I can't solve the problem.
Any help is needed urgently. Thank you.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden