mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-09 04:10:39 +00:00
AGL Fullscreen: Try to create a full screen context first, failing that create a non-fullscreen context.
This commit is contained in:
parent
b99e8c5829
commit
231f83186a
|
@ -40,7 +40,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
if (GraphicsContext.GetCurrentContext == null)
|
if (GraphicsContext.GetCurrentContext == null)
|
||||||
GraphicsContext.GetCurrentContext = AglContext.GetCurrentContext;
|
GraphicsContext.GetCurrentContext = AglContext.GetCurrentContext;
|
||||||
}
|
}
|
||||||
public AglContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool fullscreen)
|
public AglContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext)
|
||||||
{
|
{
|
||||||
Debug.Print("Context Type: {0}", shareContext);
|
Debug.Print("Context Type: {0}", shareContext);
|
||||||
Debug.Print("Window info: {0}", window);
|
Debug.Print("Window info: {0}", window);
|
||||||
|
@ -48,11 +48,10 @@ namespace OpenTK.Platform.MacOS
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
this.carbonWindow = (CarbonWindowInfo)window;
|
this.carbonWindow = (CarbonWindowInfo)window;
|
||||||
|
|
||||||
|
|
||||||
if (shareContext is AglContext)
|
if (shareContext is AglContext)
|
||||||
shareContextRef = ((AglContext)shareContext).contextRef;
|
shareContextRef = ((AglContext)shareContext).contextRef;
|
||||||
|
|
||||||
CreateContext(mode, carbonWindow, shareContextRef, fullscreen);
|
CreateContext(mode, carbonWindow, shareContextRef, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,7 +97,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
AddPixelAttrib(aglAttributes, Agl.PixelFormatAttribute.AGL_ACCUM_ALPHA_SIZE, mode.AccumulatorFormat.Alpha);
|
AddPixelAttrib(aglAttributes, Agl.PixelFormatAttribute.AGL_ACCUM_ALPHA_SIZE, mode.AccumulatorFormat.Alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (fullscreen)
|
if (fullscreen)
|
||||||
{
|
{
|
||||||
AddPixelAttrib(aglAttributes, Agl.PixelFormatAttribute.AGL_FULLSCREEN);
|
AddPixelAttrib(aglAttributes, Agl.PixelFormatAttribute.AGL_FULLSCREEN);
|
||||||
}
|
}
|
||||||
|
@ -127,15 +126,27 @@ namespace OpenTK.Platform.MacOS
|
||||||
myAGLPixelFormat = Agl.aglChoosePixelFormat(
|
myAGLPixelFormat = Agl.aglChoosePixelFormat(
|
||||||
ref gdevice, 1,
|
ref gdevice, 1,
|
||||||
aglAttributes.ToArray());
|
aglAttributes.ToArray());
|
||||||
|
|
||||||
|
Agl.AglError err = Agl.GetError();
|
||||||
|
|
||||||
|
if (err == Agl.AglError.BadPixelFormat)
|
||||||
|
{
|
||||||
|
Debug.Print("Failed to create full screen pixel format.");
|
||||||
|
Debug.Print("Trying again to create a non-fullscreen pixel format.");
|
||||||
|
|
||||||
|
CreateContext(mode, carbonWindow, shareContextRef, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myAGLPixelFormat = Agl.aglChoosePixelFormat(
|
myAGLPixelFormat = Agl.aglChoosePixelFormat(
|
||||||
IntPtr.Zero, 0,
|
IntPtr.Zero, 0,
|
||||||
aglAttributes.ToArray());
|
aglAttributes.ToArray());
|
||||||
}
|
|
||||||
|
|
||||||
MyAGLReportError("aglChoosePixelFormat");
|
MyAGLReportError("aglChoosePixelFormat");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// create the context and share it with the share reference.
|
// create the context and share it with the share reference.
|
||||||
this.contextRef = Agl.aglCreateContext(myAGLPixelFormat, shareContextRef);
|
this.contextRef = Agl.aglCreateContext(myAGLPixelFormat, shareContextRef);
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
public IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool DirectRendering)
|
public IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool DirectRendering)
|
||||||
{
|
{
|
||||||
return new AglContext(mode, window, shareContext, false);
|
return new AglContext(mode, window, shareContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IGraphicsMode CreateGraphicsMode()
|
public IGraphicsMode CreateGraphicsMode()
|
||||||
|
|
Loading…
Reference in a new issue