[eq-dev] NSOpenGLContext

3 views
Skip to first unread message

Stephen Furlani

unread,
Jan 22, 2010, 11:28:40 AM1/22/10
to eq-...@equalizergraphics.com
Hello,

I have a question about the OpenGLContexts with Equalizer.

In the Mac OS (as you know) there are multiple APIs for interfacing
with OpenGL. Equalizer uses AGL (Carbon) while the software I'm
working with uses NSGL/CGL.

Now, NSGL has an object NSOpenGLContext which can be initialized in
the following manner:

NSOpenGLContext *myContext = [[NSOpenGLContext alloc]
initWithCGLContext:];

Can I initialize the NSOpenGLContext with the CGLContext returned from
the AGLContext generated by Equalizer!?

CGLContext cgl_ctx;
if (aglGetCGLContext (AGLContextFromEQ, cgl_ctx)) {
NSOpenGLContext *myContext = [[NSOpenGLContext alloc]
initWithCGLContext: cgl_ctx ];
}

Or is that going to open a can of worms?

I am only asking this because I'm trying to be minimally invasive with
my re-factoring of this code to make it "just work" as a first-pass
prototype. Instead of using the standard NSOpenGLView I'm using
MYOpenGLView which will contain/return a NSOpenGLContext that is not
the one created by default for the NSOpenGLView but one created by
Equalizer.

thoughts? The code I'm working with is *NOT* encapsulated (even with
the MVC cocoa good-practices) at all, and the code which draws openGL
stuff is mixed in with notifications and all this other GUI gunk and
database management. It's quite a mess so the less I have to change,
the better it will be.

-Stephen

_______________________________________________
eq-dev mailing list
eq-...@equalizergraphics.com
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Stefan Eilemann

unread,
Jan 24, 2010, 8:27:38 AM1/24/10
to Equalizer Developer List
Hi,

On Fri, Jan 22, 2010 at 5:28 PM, Stephen Furlani
<stephen...@gmail.com> wrote:

> In the Mac OS (as you know) there are multiple APIs for interfacing
> with OpenGL.  Equalizer uses AGL (Carbon) while the software I'm
> working with uses NSGL/CGL.
>

> Can I initialize the NSOpenGLContext with the CGLContext returned from
> the AGLContext generated by Equalizer!?

> Or is that going to open a can of worms?

I'm not really the one to ask, since I don't know Cocoa well enough.
From what I can tell, it looks legit.

I suppose you should try it out and/or ask on the mac-opengl of
cocoa-dev mailing lists. I've had a lot of trouble with
multithreading, since the Carbon OpenGL interface can't officially be
used in a thread-safe manner. You can find some of my posts in the
mac-opengl archives.


Cheers,

Stefan.

Reply all
Reply to author
Forward
0 new messages