Mailing Lists: Apple Mailing Lists

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

Re: CIImage and un-explained borders



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
        NSOpenGLPFAColorSize24,
        NSOpenGLPFADepthSize16,
        NSOpenGLPFADoubleBuffer,
        NSOpenGLPFAAccelerated,
        0
    };

    // Create our non-FullScreen pixel format.
    NSOpenGLPixelFormat* pixelFormat = [[NSOpenGLPixelFormat allocinitWithAttributes:attrs];

    self = [super initWithFrame:frameRect pixelFormat:pixelFormat];

//Set it up to a 1000x1000 ortho
[[self openGLContextmakeCurrentContext];
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho0100010000, -11); 
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();

//Set the viewport
glViewport(00, [self bounds].size.width, [self bounds].size.height);

//Create CI Context
ciContext = [[CIContext contextWithCGLContext:[[self openGLContextCGLContextObjpixelFormat:[[self pixelFormatCGLPixelFormatObjoptions:[NSDictionary dictionaryWithObjectsAndKeysnil]] retain];

//Read in the image
image = [[CIImage imageWithContentsOfURL: [NSURL fileURLWithPath:[[[NSBundle mainBundleresourcePathstringByAppendingPathComponent:@"logo.jpg"]]] retain];

    return self;
}

- (void) drawRect:(NSRect)aRect
{
//Clear to white
glClearColor1.01.01.01.0 );
glClearGL_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 openGLContextflushBuffer];
}

- (void) reshape
{
glViewport(00, [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>)



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.