GLX or AGL ?


I have just seen that we could use GLX under MacOS X. I’am new on this OS so I don’t know witch API betwwen AGL and GLX we should use now. Any answer?


Although I don’t believe it mentions GLX, this is a useful document

There are basically 5 ways to access opengl functionality on MacOSX.

Core OpenGL
AGL (C interface to using carbon GUI library)
CocoaGL (ObjC interface using cocoa GUI library)
GLUT (Apple implmentation of GLUT sitting on top of CocoaGL)

There is a library that provides an interface to Core OpenGL - it is only for full screen rendering, but you get much greater control of the GPU etc.

Both AGL and CocoaGL are built on Core OpenGL and provide windowing, font rendering etc.

I do not know but I would guess that that the GLX library is actually calling the AGL library. If you use GLX then you and anyone that wants to use your software must run the software inside an X11 environment (which is not installed by default) as opposed to ‘natively’ on OS X. I believe (although I am not sure) that this would lead to poorer performance than running natively. Either way most users prefer to run native code. If you are starting from scratch I would use one of the OSX native apis - but if you are porting existing GLX code then it probably makes sense to use GLX.

I hope that helps,

Use GLX, it is more platform-independent and really simple to use.

Even if GLX is implemented via AGL, the performance penalty won’t be visible (as GL operations will still execute directly )

That’s help, cheers :slight_smile:

If you use GLX, you will not be making a native Mac OS X application, and it won’t run on a computer with a default installation of the OS. Usually, that’s good reason not to use it.

If you’re just porting a preexisting X11 application, then you don’t have a choice, of course.

AGL, NSGL and GLX are all layers on the underlying CGL implementation, though they add value (AGL lets you use a GL context in a Carbon window, NSGL lets you use a GL context in a Cocoa window, and GLX lets you use a GL context in an X11 window). In general, there’s no need to use CGL directly – one of the layers on top will be a better match for your application.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.