Skip to content

Make GLControl work on OS X #66

Merged
merged 4 commits into from Mar 6, 2014

3 participants

@Sappharad

This isn’t the greatest solution, but at least it doesn’t require us to reference WinForms in OpenTK and it works perfectly for what I’m using.

Not sure if you want to include it or not, but here it is if you do.

@Frassle Frassle commented on an outdated diff Feb 22, 2014
Source/GLControl/CarbonGLControl.cs
@@ -46,9 +46,23 @@ internal CarbonGLControl(GraphicsMode mode, Control owner)
this.mode = mode;
this.control = owner;
- window_info = Utilities.CreateMacOSCarbonWindowInfo(control.Handle, false, true);
+ window_info = Utilities.CreateMacOSCarbonWindowInfo(control.Handle, false, true, GetXOffset, GetYOffset);
@Frassle
Frassle added a note Feb 22, 2014

Added whitespace, check it's not put in tabs instead of spaces. Few other places in the changelog as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Frassle Frassle and 1 other commented on an outdated diff Feb 22, 2014
Source/OpenTK/Platform/MacOS/AglContext.cs
@@ -173,31 +173,26 @@ void SetBufferRect(CarbonWindowInfo carbonWindow)
return;
// Todo: See if there is a way around using WinForms.
- throw new NotImplementedException();
-#if false
- System.Windows.Forms.Control ctrl = Control.FromHandle(carbonWindow.WindowRef);
+ //throw new NotImplementedException();
+ /*System.Windows.Forms.Control ctrl = Control.FromHandle(carbonWindow.WindowHandle);
@Frassle
Frassle added a note Feb 22, 2014

Would be simpler to remove this code from the commit than to comment it out.

@Sappharad
Sappharad added a note Feb 22, 2014

Yes, you're right. I got rid of some of it, I guess I didn't notice this was still present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@thefiddler

@Sappharad I can verify that this works on my system. Two comments:

  1. please add an overload of Utilities.CreateMacOSCarbonWindowInfo that matches the old signature (without the xOffset & yOffset parameters) and calls the new signature internally. For better or worse, this is a public API so we should maintain backwards compatibility if at all possible.
  2. rebase against current opentk/develop so I can merge directly.

Thanks!

Paul Kratt added some commits Feb 20, 2014
Paul Kratt Make GLControl work on OS X
This isn’t the greatest solution, but at least it doesn’t require us to
reference WinForms in OpenTK and it works perfectly for what I’m using.
794d45f
Paul Kratt Fix potential exception that I was ignoring.
This can happen, so we should handle it
ba0180e
Paul Kratt Update spacing and formatting to match existing style 0df7c55
Paul Kratt Call the new code instead of leaving the old version untouched d9a7821
@Sappharad
  1. The old signature was still there. I've updated it to call the new one.
  2. I have no idea what the hell I'm doing, so I hope I did this right. The files tab still shows the correct changes, but commits is showing a bunch of garbage now.
@Frassle
Frassle commented Feb 26, 2014

Looks like you merged instead of rebased. Try to reset back one commit, then rebase. Something like:
git reset --hard HEAD^
git rebase remotes/upstream/develop
git push origin -f

That assumes you have a remote upstream that points to github.com/opentk/opentk and that the latest commit (HEAD) is the merge commit.

@Sappharad

I think it worked! Thanks! Can you confirm?

On a side note, this code is being used for OGL support in my most recent release of the OS X port of the BizHawk emulator, so rest assured that if it ever breaks I'll probably be the first to complain and/or fix it.

@Frassle
Frassle commented Feb 27, 2014

Yes that looks fixed to me.

@thefiddler thefiddler merged commit d9a7821 into opentk:develop Mar 6, 2014

1 check passed

Details default The Travis CI build passed
@thefiddler

Many thanks, merged!

I was aware of the BizHawk emulator, but had no idea it was using OpenTK! This is awesome, let me know if you have encounter any issues down the road.

@thefiddler thefiddler added this to the 1.1.1 milestone Mar 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.