2020-12-18 13:45:06 +03:00
|
|
|
#if __MACOS__
|
|
|
|
using System;
|
2016-05-26 16:06:52 +03:00
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
using AppKit;
|
|
|
|
using Foundation;
|
|
|
|
using CoreAnimation;
|
|
|
|
using OpenGL;
|
|
|
|
using ObjCRuntime;
|
|
|
|
|
2022-11-10 19:59:26 +03:00
|
|
|
namespace Xamarin.Mac.Tests {
|
2016-05-26 16:06:52 +03:00
|
|
|
[TestFixture]
|
2021-03-16 17:15:30 +03:00
|
|
|
[Preserve (AllMembers = true)]
|
2022-11-10 19:59:26 +03:00
|
|
|
public class CAOpenGLLayerTest {
|
2020-12-18 13:45:06 +03:00
|
|
|
#if !DYNAMIC_REGISTRAR
|
|
|
|
[Ignore ("https://github.com/xamarin/xamarin-macios/issues/10284")]
|
|
|
|
#endif
|
2016-05-26 16:06:52 +03:00
|
|
|
[Test]
|
|
|
|
public void SubclassedTest ()
|
|
|
|
{
|
2021-05-13 15:41:07 +03:00
|
|
|
TestRuntime.AssertNotVirtualMachine ();
|
|
|
|
|
2016-05-26 16:06:52 +03:00
|
|
|
using (var layer = new OpenGLLayer ()) {
|
|
|
|
Messaging.IntPtr_objc_msgSend (layer.Handle, Selector.GetHandle ("copyCGLPixelFormatForDisplayMask:"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-10 19:59:26 +03:00
|
|
|
public partial class OpenGLLayer : CAOpenGLLayer {
|
2016-05-26 16:06:52 +03:00
|
|
|
public override CGLPixelFormat CopyCGLPixelFormatForDisplayMask (uint mask)
|
|
|
|
{
|
2022-11-10 19:59:26 +03:00
|
|
|
var attribs = new object [] {
|
|
|
|
CGLPixelFormatAttribute.Accelerated,
|
|
|
|
CGLPixelFormatAttribute.DoubleBuffer,
|
|
|
|
CGLPixelFormatAttribute.ColorSize, 24,
|
2016-05-26 16:06:52 +03:00
|
|
|
CGLPixelFormatAttribute.DepthSize, 16 };
|
|
|
|
|
|
|
|
CGLPixelFormat pixelFormat = new CGLPixelFormat (attribs);
|
|
|
|
return pixelFormat;
|
|
|
|
}
|
|
|
|
}
|
2020-12-18 13:45:06 +03:00
|
|
|
}
|
|
|
|
#endif // __MACOS__
|