kanato's picture

Mac OS X progress

I have committed preliminary Mac OS support to the branches/macos folder in subversion. I am starting a new topic because the old topic has a bunch of discussion which isn't relevant now.

Things which aren't currently supported:
* Fullscreen
* WinForms integration, including GLControl

Things which are supported:
* Game window creation
* Keyboard and mouse events
* Enumeration of supported display modes

OpenTK Example results on my machine are listed below. My machine is a Mac Mini, with OS X 10.4.11 installed. Graphics card is a built-in Intel GMA 950.

GLSL 1: First shader: Works, but gives message about requiring OpenGL 2.0
GLSL 2: Julia set: Gives message about requiring OpenGL 2.0, then black screen with FPS counter
OpenAL: Playback: Works
OpenGL 5: Vertex arrays: Null reference exception
OpenGL: GLU Tesselation: KeyNotFoundException is thrown
OpenGL: Simple FBO: Works (I am unsure if the resulting image is correct though)
Test: Audio Context Test: No error message.
Test: GameWindow states: Fullscreen min/max not implemented.
Test: Input Logger: Works okay if you click on the "hidden input window" at first. If you click on anything else, it stops working.
Test: Math speed test: KeyNotFoundException is thrown
Test: Resolution changes: Not supported yet.
Tutorial 1: Simple Window: Works
Tutorial 2: Immediate mode: Works
Tutorial 3: Display Lists: Works
Tutorial 3: Fonts: Works
Tutorial 4: Text: Runs, but text layout is messed up, except for FPS counter.
Tutorial 5: Texture mapping: Works
Tutorial 8: VBO's: Works after message about needing OpenGL 1.5.

WinForms 1: Runs, but no colors appear.
WinForms 2: Runs, but no response to input.
WinForms 3: Works
WinForms 4: Runs, but nothing appears in controls.

The KeyNotFoundException appears to be a bug in the CarbonGLNative window, so I will need to examine that more closely. Kamujin, if you can run the examples and let me know if you get the same results that will be helpful.

I've also done some refactoring in the library in how platform specific classes are instantiated.


Comment viewing options

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

I am going on thanksgiving vacation in two days, so I probably won't be available to comment or work on this until after thanksgiving weekend. After that I expect to hit the ground running on getting WinForms support working.

the Fiddler's picture

Sounds great, happy thanksgiving!

kanato's picture

Okay, I am back. I just upgraded my mac mini to 2 GB of ram from 512 MB too, so it will make development on it a lot more tolerable.

JTalton's picture

I have had a couple of hits lately asking about OSX support for my GTK# GLWidget. Once this is solid, would there be any objection to using this code as a basis for getting GLWidget working with OSX?

kanato's picture

I have no objections to that. What needs to be done to make GLWidget work with OSX? Do you just need the AGL wrapper codes or something else in addition?

kanato's picture

Ok, an update on progress getting GLControl to work. First let me say, wow, what a nightmare. It's one of those problems that seems so obvious in hindsight but was so unclear initially. The problem was that AGL requires a call to aglSetDrawable for a context, but you must pass the desktop window handle to it. That part was always clear, however what was not clear initially was that because the context was created in the GLControl constructor this is before the control is added to the form it will end up on.

So now we can render to GLControl on Mac OS X. The three examples all work, although in the last example (Multiple GLControls test) the colors only show up after the window is resized.

Now the only thing left to get working is full screen support. Also, more testing is needed, so if anyone has a mac, give it a shot!

JTalton's picture

GLWidget is a single cs file that just needs the right calls to setup the context. I've never messed with the AGL but I don't expect it to be too different from the WGL and GLX.
In GTK there is a realized event, and when this first happens is when I initialize the context. This ensures that the proper handles have all been initialized beforehand.

I'd love to test out the new functionality on my Mac, but I currently have a few higher priority items. I'll try to test it soon.

Glad to have OS X support in OpenTK! Thanks!

objarni's picture

For testing purposes: Could someone compile, zip and attach this in this thread so I can share it with MAC-friends..? Thanks beforehand..

kanato's picture

Ok, I have attached the compiled binaries for the example launcher. I packed them into a finder friendly application, so they should be able to unzip and double-click. Have them test at least the examples "OpenAL: Playback" "Tutorial 2: Immediate mode" and WinForms 1 & 2. WinForms 2 will also show the driver name, which is useful to know for reports of working or non-working status. A couple examples won't work for sure, like tutorial 4 and "Test: GameWindow states," and the GLU tesselation test. The animated Julia set doesn't work on mine, but that may be because my video card sucks. Resolution changing also does not work at this point.

otk-macos.tar.gz665.8 KB
objarni's picture

Thanks kanato!

Do I have to tell my pals to download/install mono..? Which version if so? Or is it there by default? What about OpenGL/OpenAL?