kvark's picture

Fail to create Core OpenGL profile context (3.2) on Mac OS 10.7 (Lion)

Project:The Open Toolkit library
Category:bug report

I'm specifying OpenGL version 3.2 when creating a context (with GLWidget), but as a result I'm given 2.1 context (GLSL version 120 only and no VAO).

At the same time OpenGL extension viewer allows switching between profiles. On Compatibility it shows 2.1, while on Core it shows 3.2 version.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kvark's picture


I've created a small patch that should make Core Profile work under OSX Lion.
I'm going to test it in a couple of days and report the result.

It looks like we need to move from AGL to CGL in order to create a core 3.2 profile under OSX.
As Fiddler doesn't have this platform at home, I'll try to implement this chunk of functionality on my own.
Will keep you informed on this thread about updates.

kvark's picture


As it's quite a lot of work here - I would benefit from the source control. Fiddler, maybe I should branch off and keep my changes in SVN? Could you give me the write access?

kvark's picture


Ok, I've got basic Cgl context management working, sharing some code with Agl implementation via newly created common class.
Now I've stack with the fact most of my shaders using "#version 130" (as a minimum required version for them to work). Apparently Lion's OpenGL 3.2 Core Context doesn't like this version and strongly demands "#version 150 core". So I'll be able to advance only after fixing all the shaders.

Anyway, The Fiddler, do you have an idea of how to proceed in the most effective way? I can provide a (big) patch or commit to SVN directly (if you grant me the access) without breaking anything. Waiting for your word here...

Ollhax's picture


Did these fixes ever reach the SVN? I'm interested too in a fix for this problem, a bit more than a year later :)

Ollhax's picture


I've made a basic attempt at cocoa bindings for OpenTK. Pretty rough, but perhaps enough to help someone: https://github.com/Ollhax/opentk.git

Read the commit text if you want details on my implementation, what's missing (= most of it :)) and so on.

the Fiddler's picture


Priority:critical» normal
Status:open» need info

OpenTK can now construct a 3.x+ context via the SDL backend.

Judging from Apple's documentation, 3.x+ requires Cocoa+NSOpenGLView. Agl definitely cannot do this, but if Cgl can, then it would make sense to use Cgl instead of Agl throughout.

Kvark, it's been a long time, but is your code/patch available somewhere online?

kvark's picture


Indeed, your reply is a bit too late. Since the time I was doing that I've managed to leave Boo, jump over Dart, then Haskell, and now settled happily with Rust. Yet, I'm glad to see your project is still around and blossoming.

Everything that I had at that point I uploaded here (since this forum doesn't seem to support attachments). I'll try to keep it for at least a week, but I'd advise you to copy or clone the gist. Also, it comes with absolutely no warranty, since it's as foreign to me now as it is to you.

Good luck!

the Fiddler's picture


Status:need info» closed

Thanks, I've made a fork so feel free to delete the gist.

That's quite an evolution in languages, I find myself writing C++, C and assembly for embedded platforms instead. Writing platform backends for OpenTK is almost a breath of fresh air compared to that :)