Пример #1
0
        /// <summary>
        /// Actually create this GraphicsWindow resources.
        /// </summary>
        /// <param name="ctx">
        /// A <see cref="GraphicsContext"/> used for allocating resources.
        /// </param>
        protected override void CreateObject(GraphicsContext ctx)
        {
            if (ctx != null)
            {
                throw new ArgumentException("context not required", "ctx");
            }

            sLog.Info("Create rendering window '{0}'.", _RenderForm != null ? _RenderForm.Text : "untitled");

            // Obtain device context (relative to window)
            _DeviceContext = DeviceContextFactory.Create(_RenderControl);
            _DeviceContext.IncRef();

            // Choose "best" pixel format matching with surface configuration
            _DeviceFormat = _SurfaceFormat.ChoosePixelFormat(_DeviceContext, ValidPixelFormat);
            // Set device pixel format
            _DeviceContext.SetPixelFormat(_DeviceFormat);
            // Confirm surface configuration
            _SurfaceFormat.SetBufferConfiguration(_DeviceFormat);

            // Set swap interval
            SetSwapInterval();
        }