Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CGL vs AGL vs OpenGL vs NSOpenGL vs CoreAnimation(CALayer)

I am trying to understand few things on Mac related to OpenGL framework integration in the form of layers. Well basically when I want to understand 3D technologies present in OS X and which layer is OpenGL's actual implentation layer.

From reading apple docs, below is what I have understood so far:

1.NSOpenGLContext object wraps a low-level, platform-specific Core OpenGL (CGL) context.

= This makes it clear that NSOpenGL makes use of CGL.

2.The AGL (Apple Graphics Library) API is part of the Apple implementation of OpenGL in Mac OS X.

= So, does AGL and CGL are related in any way?

3.CGL (Core OpenGL) is the lowest-level programming interface for the Apple implementation of OpenGL.

= Does it mean Standard OpenGL API's are just wrapper over CGL?

4.CoreAnimation seems to be combo of Core Graphics, Open-GL and Quick-time. But I am not sure what it uses underneath it, I mean actual implementation layer, is it again CGL?

Things are not completely clear to me. I am still reading though and I have asked somewhat related question in past but with incomplete knowledge.

I would really appreciate if someone can share his understanding on matter.

like image 347
RLT Avatar asked Feb 21 '23 16:02

RLT


1 Answers

NSOpenGLContext, AGL and CGL are all APIs for setting up an OpenGL context you can draw into.

Use NSOpenGLContext unless you already know you have a reason not to.

Use AGL if you are writing a Carbon application or if you need compatibility with Mac OS 9 (As of 2012, that basically means: don't).

Both AGL and NSOpenGLContext are implemented on top of CGL. However, not all the necessary parts of CGL are actually public APIs. Last time I checked, the only public parts of the CGL API where the ones that allow you to create a fullscreen OpenGL context. If you want OpenGL in a window or you want the option of showing dialog boxes or some NSViews on top of your OpenGL, you probably can't use CGL.

CoreAnimation is a framework for (mostly UI) animations; you can use CoreAnimation without using OpenGL directly. I have never used it myself, but I assume it also allows you to create an OpenGL context for an animation layer. Use it if you already have other reasons to use CoreAnimation, or if you want to combine OpenGL graphics and Mac GUI widgets in creative ways.

like image 72
wolfgang Avatar answered Mar 03 '23 06:03

wolfgang