kanato's picture

OpenTK Mac OS X support.

Well, I thought I would let you know I've been working on writing support for Mac OS X for OpenTK. I've successfully wrapped window creation and event processing through the Carbon API. I need to work on keyboard and mouse event processions, then AGL wrapping, then I think I'll be to the point where I can integrate with OpenTK. Hopefully I can get there by early next week.


Comments

Comment viewing options

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

Ok, I've updated the patch here (same link):
http://agate.sourceforge.net/download/macos.patch

This adds Mac OS X support for the GameWindow object. I've also added the class factory for each OS to simplify the creation of implementation objects.

I added to Context objects an Update method, because AGL requires that aglUpdateContext be called on the context when its host window changes size.

Fullscreen is not supported yet, but discovery of display devices and supported resolutions is. I'm not quite sure where to go with fullscreen support, because the model seems different than Windows or X11. Fullscreen support does not require that one creates a window that covers the screen area, in Mac OS you can simply acquire the display device, and either attach an AGL context to the full screen, or write directly to the framebuffer. AGL also includes a convenience method aglSetFullScreen where you tell it the parameters you want and it just does it. At the moment, I am unsure which approach is best.

GLControl is not supported yet either. For some reason, I cannot get any GL drawing to show up on a WinForms control. In spite of this, through the context creation for it no errors or inappropriate null values are reported. I think this might a Mono/WinForms issue, but I am not sure right now.

Also some of the stability issues from the last version of the patch are fixed. There is a weird issue where if four game windows are openned in succession (ie. by running four examples), there is a crash when the window title is set. I am still working to resolve this.

Also, in GameWindow.cs: Added code in ExitInternal so that if GameWindow.Run() is not used, then an event is raised instead.

the Fiddler's picture

Thanks. Maybe you could raise the question on MacOS winforms+opengl at #monodev (irc.gnome.org), someone is bound to know how to do this.

I'm going to branch OpenTK as soon as 0.9.1 is out, and apply the patch. (Not doing it right now, in order to add the wave decoder and OpenAL examples first). Looks great.

kanato's picture

That's a good idea. I'll do that once the patch is applied, so I can refer people to the code.

objarni's picture

Any news on this "hot topic" :) ?

kanato's picture

Not much. I have followed the SVN updates, and some stuff was added to INativeGLWindow (WindowState and WindowBorder), so I have updated my OSX implementation to implement these properties, so that it at least compiles but I have not had much time to make the settings work. I am sort of waiting for the 0.9.1 release when Fiddler said he would branch OpenTK for this patch; it would be good to have this under version control before I put a lot more work into it.

Zowch's picture

Any updates on this? I was hoping to play around with a pet project on my new Mac, and maybe see what I could do to help this along, but the patch here doesn't even apply against trunk anymore after the GL reorganization and whatnot.

I'd love to do what I can to help this along. :)

kanato's picture

There's a branch that's made specifically for the macos port. Look in the SVN under the branches folder. I've updated the patch too, it should work when applied to the macos branch. I've sent Fiddler a message about committing it but he hasn't responded yet.

the Fiddler's picture

The patch doesn't apply cleanly to the macos branch - it looks like the OpenTK.Platform.Factory class is missing. Wild shot: maybe you need to svn add the source file first?

kanato's picture

hmm.. I thought I had fixed that. I will try to get it fixed in the next couple of days.

kanato's picture

Well, that's what happens when I use svn from the command line on my mac instead of tortoise svn on windows, and I forget about all the stuff that tortoise has kept track of, like all the files that got added. It should work now, I've reuploaded the patch, reapplied it to the macos branch and tested it on my mac, and it seems to work now.

Also, it seems the OpenAL example works now, so either some bug was fixed in the OpenTK code since I tried it out, or some system software update fixed something on my mac.