Reply To: NSImage to Syhon

Home Forums Syphon Syphon Development – Developer NSImage to Syhon Reply To: NSImage to Syhon

Rick Burnett

I’m using:

CGLSetCurrentContext( [context CGLContextObj] );

to set the current context, this is the context from my NSOpenGLVuew, I don’t see anything that would make it not current. This is also the context I am passing into the Syphon when I start the server.

I think what I have is Core context correct?

Yes, I am positive on the texture target. I used apitrace on the running app to just make sure textures are being constructed properly and I can view them at any frame. They look correct in apitrace.

I don’t see any errors being reported, including in API trace.

Just for the heck of it, I created a garbage texture basically just with some fake data to see if it would pass it along. I did get it to send something, but it only draws 1/2 of the display diagonal.


Context is being generated in my main like so:

StretchView *view = [[StretchView alloc] initWithFrame: NSMakeRect (0, 0, WIDTH, HEIGHT) ];

StretchView is derived from NSOpenGLView. (This was sample code I found for Cairo_nsgl usage)

And the initialization of all the Cairo stuff is (and syphon)

context = [super openGLContext];

    [context makeCurrentContext];

    cairo_device_t *device = cairo_nsgl_device_create (context);
    surface = cairo_gl_surface_create_for_view (device, self, WIDTH, HEIGHT);

    cr = cairo_create (surface);

    renderTimer = [NSTimer timerWithTimeInterval:0.001   //a 1ms time interval
    [[NSRunLoop currentRunLoop] addTimer:renderTimer
    [[NSRunLoop currentRunLoop] addTimer:renderTimer
                                forMode:NSEventTrackingRunLoopMode]; //Ensure timer fires during resize

   //start syphon
   myServer = [[SyphonServer alloc] initWithName:@"Cairo Output" context:[context CGLContextObj]  options:nil];

I initially didn’t want to post in a million things I tried until I had some sort of direction to start. Most of my GL work has been on the Raspberry Pi platform lately so still learning a lot about how it’s put together in OSX.

Thanks for taking a look.

  • This reply was modified 3 years, 10 months ago by Rick Burnett. Reason: fixing code tags