| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| I made an app to demonstrate the issue. It is only 75 lines of code. Any help is greatly appreciated. It is very frustrating. The xcode project can be found here: And this is the source of the main file: // // MyOpenGLView.m // CI Problem // // Created by Michael Miller on 10/28/07. // Copyright 2007 __MyCompanyName__. All rights reserved. // #import "MyOpenGLView.h" #import <Quartz/Quartz.h> @implementation MyOpenGLView - (id)initWithFrame:(NSRect)frameRect{ // Pixel Format Attributes for the View-based (non-FullScreen) NSOpenGLContext NSOpenGLPixelFormatAttribute attrs[] = { // Specifying "NoRecovery" gives us a context that cannot fall back to the software renderer. This makes the View-based context a compatible with the fullscreen context, enabling us to use the "shareContext" feature to share textures, display lists, and other OpenGL objects between the two. NSOpenGLPFANoRecovery, // Attributes Common to FullScreen and non-FullScreen NSOpenGLPFAColorSize, 24, NSOpenGLPFADepthSize, 16, NSOpenGLPFADoubleBuffer, NSOpenGLPFAAccelerated, 0 }; // Create our non-FullScreen pixel format. NSOpenGLPixelFormat* pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs]; self = [super initWithFrame:frameRect pixelFormat:pixelFormat]; //Set it up to a 1000x1000 ortho [[self openGLContext] makeCurrentContext]; glMatrixMode (GL_PROJECTION); glLoadIdentity (); glOrtho( 0, 1000, 1000, 0, -1, 1); glMatrixMode (GL_MODELVIEW); glLoadIdentity (); //Set the viewport glViewport(0, 0, [self bounds].size.width, [self bounds].size.height); //Create CI Context ciContext = [[CIContext contextWithCGLContext:[[self openGLContext] CGLContextObj] pixelFormat:[[self pixelFormat] CGLPixelFormatObj] options:[NSDictionary dictionaryWithObjectsAndKeys: nil]] retain]; //Read in the image image = [[CIImage imageWithContentsOfURL: [NSURL fileURLWithPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"logo.jpg"]]] retain]; return self; } - (void) drawRect:(NSRect)aRect { //Clear to white glClearColor( 1.0, 1.0, 1.0, 1.0 ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); //Draw the image in this rect CGRect rect; rect.origin.x = 500; rect.origin.y = 500; rect.size.width = 300; rect.size.height = 300; [ciContext drawImage:image inRect:rect fromRect:[image extent]]; //Flush The Buffer [[self openGLContext] flushBuffer]; } - (void) reshape { glViewport(0, 0, [self bounds].size.width, [self bounds].size.height); } @end Thanks for any help any one can give, Mike |
_______________________________________________ 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
| References: | |
| >CIImage and un-explained borders (From: Mike Miller <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.