Esempio n. 1
0
        public void Bind_CallsInitialize()
        {
            // Arrange
            var wgl = CreateMockWgl();
            
            var context = new WindowsContext(wgl, Substitute.For<ILibrary>(), null, new ContextCreationParameters {Device = 1, Window = 1});

            // Act
            context.Bind();
            
            // Assert
            wgl.Received(1).wglCreateContext(Arg.Any<IntPtr>());
        }
Esempio n. 2
0
        public IContext Create(ContextCreationParameters parameters)
        {
            if (parameters == null)
                throw new ArgumentNullException("parameters");
            if (os == PlatformID.Win32NT)
            {
                var loader = LibraryLoader;
                var libGL = loader.Load("OpenGL32");
                var gdi32 = loader.Load("GDI32");

                var wgl = Mapper.Implement<IWGL>(new CompositeLibraryProvider(libGL, gdi32));

                var context = new WindowsContext(wgl, libGL, null, parameters);
                context.Initialize();
                return context;
            }
            throw new PlatformNotSupportedException();
        }