mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-25 00:27:50 +00:00
Fix loss of first frame with GLControl.
This commit is contained in:
parent
1a4a3238c2
commit
b6642764eb
|
@ -82,6 +82,13 @@ namespace OpenTK
|
|||
|
||||
base.OnResize(e);
|
||||
}
|
||||
protected override void OnParentChanged(EventArgs e)
|
||||
{
|
||||
if (context != null)
|
||||
context.Update(window_info);
|
||||
|
||||
base.OnParentChanged(e);
|
||||
}
|
||||
|
||||
#region --- Protected Methods ---
|
||||
|
||||
|
|
|
@ -193,8 +193,17 @@ namespace OpenTK.Platform.MacOS
|
|||
}
|
||||
void SetDrawable(CarbonWindowInfo carbonWindow)
|
||||
{
|
||||
IntPtr windowPort;
|
||||
|
||||
IntPtr windowPort = GetWindowPortForWindowInfo(carbonWindow);
|
||||
|
||||
Agl.aglSetDrawable(contextRef, windowPort);
|
||||
|
||||
MyAGLReportError("aglSetDrawable");
|
||||
|
||||
}
|
||||
|
||||
private static IntPtr GetWindowPortForWindowInfo(CarbonWindowInfo carbonWindow)
|
||||
{
|
||||
IntPtr windowPort;
|
||||
if (carbonWindow.IsControl)
|
||||
{
|
||||
IntPtr controlOwner = API.GetControlOwner(carbonWindow.WindowRef);
|
||||
|
@ -203,21 +212,18 @@ namespace OpenTK.Platform.MacOS
|
|||
}
|
||||
else
|
||||
windowPort = API.GetWindowPort(carbonWindow.WindowRef);
|
||||
|
||||
Agl.aglSetDrawable(contextRef, windowPort);
|
||||
|
||||
MyAGLReportError("aglSetDrawable");
|
||||
|
||||
}
|
||||
public void Update(IWindowInfo window)
|
||||
return windowPort;
|
||||
}
|
||||
public void Update(IWindowInfo window)
|
||||
{
|
||||
CarbonWindowInfo carbonWindow = (CarbonWindowInfo)window;
|
||||
|
||||
|
||||
SetDrawable(carbonWindow);
|
||||
SetBufferRect(carbonWindow);
|
||||
|
||||
Agl.aglUpdateContext(contextRef);
|
||||
|
||||
}
|
||||
|
||||
void MyAGLReportError(string function)
|
||||
{
|
||||
Agl.AglError err = Agl.GetError();
|
||||
|
@ -263,12 +269,12 @@ namespace OpenTK.Platform.MacOS
|
|||
{
|
||||
Debug.WriteLine("--> Resetting drawable. <--");
|
||||
first = true;
|
||||
SetDrawable(carbonWindow);
|
||||
Update(carbonWindow);
|
||||
}
|
||||
|
||||
Agl.aglSwapBuffers(contextRef);
|
||||
MyAGLReportError("aglSwapBuffers");
|
||||
SetDrawable(carbonWindow);
|
||||
Update(carbonWindow);
|
||||
}
|
||||
|
||||
Agl.aglSwapBuffers(contextRef);
|
||||
MyAGLReportError("aglSwapBuffers");
|
||||
}
|
||||
|
||||
public void MakeCurrent(IWindowInfo window)
|
||||
|
|
Loading…
Reference in a new issue