8

I'm trying to add modern OS X support to OpenTK framework. Mac OS Lion supports OpenGL 3.2 Core context. I can successfully obtain it by using CGL. However, I can't find a straight way to bind the context to a Carbon window.

Previous OpenTK implementation used aglSetDrawable method. CGL doesn't publicly have an alternative, even though it has a similar undocumented CGLSetSurface. Any attempts to use it return error code 1001, which I can't find a description for.

Any help of getting GL 3.2 on a Carbon window?

genpfault
  • 51,148
  • 11
  • 85
  • 139
kvark
  • 5,291
  • 2
  • 24
  • 33
  • I haven't worked with lion yet, and also not with opengl 3.2 context. anyways the common way to set the context in CGL is CGLSetCurrentContext. Maybe that works? – moka Aug 12 '11 at 16:50
  • @moka. The context itself is OK. The question is about attaching it to a window without using Cocoa. – kvark Aug 12 '11 at 17:31

1 Answers1

1

I can't say I have tried this, but you might be able to get it to work by using a HICocoaView containing an NSOpenGLView (which will take an NSOpenGLContext that can be created froma CGLContext).

AGL itself is deprecated and unlikely to receive any further updates from Apple. CGL is not intended for windowed contexts. In the long run, using Cocoa is the best route on OS X.

Stefan Werner
  • 440
  • 2
  • 7
  • Thanks for the answer, @Stefan. I understand that Cocoa is the preferred choice now. However, I need to access these functions from Mono, so Objective-C signals are really difficult way to go. It would help if someone had a library for managing NSOpenGLView context with a simple C interface.... – kvark Sep 23 '11 at 19:13
  • You can wrap Objective-C code in C++ classes, that's what wxWidgets or Qt do. A HICocoaView has a plain C interface already so you would only need to wrap a handful of calls to NSOpenGLView. – Stefan Werner Sep 25 '11 at 20:51
  • Is AGL as a whole actually deprecated? I noticed parts of it are deprecated in 10.7, but aside from that there's nothing... –  Jul 16 '12 at 22:00