Beispiel #1
0
        /// <summary>Initialize the object.</summary>
        public void initialize(iRenderingContext rc, Rational?displayRefresh)
        {
            if (null != renderContext)
            {
                throw new ApplicationException("Already initialized");
            }
            dispatcher          = Dispatcher.currentDispatcher;
            this.displayRefresh = displayRefresh;
            if (null == dispatcher)
            {
                throw new ApplicationException("Context.initialize requires the current thread to have a dispatcher");
            }

            renderContext = rc;
            context       = rc.context;
            swapChain     = rc.swapChain;
            if (rc is iDiligentWindow window)
            {
                dpiScalingFactor = window.dpiScaling;
            }

            using (var device = rc.device)
            {
                isOpenGlDevice = device.isGlDevice();

                var scDesc = swapChain.GetDesc();
                swapChainSize         = new CSize(scDesc.Width, scDesc.Height);
                swapChainFormats      = new SwapChainFormats(scDesc.ColorBufferFormat, scDesc.DepthBufferFormat, getSampleCount(swapChain));
                swapChainBuffersCount = scDesc.BufferCount;

                animation = new Animations(this);
                scene.createResources(this, device);
            }
            initializeAsync();
        }
Beispiel #2
0
        void iContent.swapChainRecreated(iDiligentWindow window)
        {
            try
            {
                swapChain = window.swapChain;
                context   = window.context;

                timersHardPause?.Dispose();
                timersHardPause = null;

                var scDesc = swapChain.GetDesc();
                swapChainSize = new CSize(scDesc.Width, scDesc.Height);
                byte samples = swapChainFormats.sampleCount;
                swapChainFormats      = new SwapChainFormats(scDesc.ColorBufferFormat, scDesc.DepthBufferFormat, samples);
                swapChainBuffersCount = scDesc.BufferCount;
            }
            catch (Exception ex)
            {
                NativeContext.cacheException(ex);
                throw;
            }
        }
Beispiel #3
0
 public bool Equals(SwapChainFormats p)
 {
     return(color == p.color && depth == p.depth && sampleCount == p.sampleCount);
 }