Re: Rendering OpenGL in timed loop (CoreVideo).
Re: Rendering OpenGL in timed loop (CoreVideo).
- Subject: Re: Rendering OpenGL in timed loop (CoreVideo).
- From: Michael Ash <email@hidden>
- Date: Sat, 11 Apr 2009 00:18:25 -0400
On Fri, Apr 10, 2009 at 9:56 PM, Brian Bruinewoud <email@hidden> wrote:
> Note that this thread is stopping on the line:
>
> GLint e = glGetError();
>
> And that getFrameForTime looks like this:
>
> - (CVReturn)getFrameForTime:(const CVTimeStamp*)outputTime
> {
> NSLog( @"getFrameForTime" );
>
> if( !shouldRun ) return kCVReturnError;
>
> redcomp = redcomp + 0.01;
> NSLog( @"... red = %f", redcomp );
>
> GLint e = glGetError();
>
> if( !displayList )
> {
> NSLog( @"Create displayList" );
> }
> else
> {
> NSLog( @"Use existing displayList" );
> }
>
> return kCVReturnSuccess;
> }
>
> If I remove the glGetError() line, everything works (NSLog messages come
> spurting out at high speed).
You can't just go and start calling OpenGL functions like that. OpenGL
depends on having a context set up, and each call is executed in that
context. This CoreVideo callback does nothing like that. All it does
is notify you each time the monitor is done refreshing. It's up to you
to set up your own GL context before you start making calls to GL
functions. I'm not 100% sure about how you do this, but I believe it
would be something like this:
NSOpenGLContext *savedCtx = [NSOpenGLContext currentContext];
[[self openGLContext] makeCurrentContext];
// your GL code here
[savedCtx makeCurrentContext];
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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