Beispiel #1
0
        protected virtual void CreateDxDevice()
        {
            if (GraphicsDeviceManager.CheckAdapterMeetsRequirements(0, minReqs))
            {
                GraphicsDeviceSettings outSettings = GraphicsDeviceManager.CreateOutputDescription(0, minReqs, desiredReqs);
                if (!GraphicsDeviceManager.CreateGraphicsDevice3D(outSettings, this, out outSettings, out gDevice, out pParams))
                {
                    deviceFailMsg = "MDX: Failed to create device";
                }

                if (gDevice != null)
                {
                    SetupView();
                }
            }
            else
            {
                deviceFailMsg = "MDX: Adapter does not meet minimum requirements";
                throw new Exception(deviceFailMsg);
            }
        }
Beispiel #2
0
        public virtual void Init(HashTableSettings settings, ICommonDeviceInterface cdi)
        {
            this.settings = settings;

            // load settings
            BackColor = (Color)settings["View3D.BgClr"];

            // filter profiles into supported
            // NOTE: Profiles should be done in CDI really
            List <GraphicsProfile> sProfiles = new List <GraphicsProfile>();

            foreach (GraphicsProfile profile in profiles)
            {
                if (GraphicsDeviceManager.CheckAdapterMeetsRequirements(((CommonDeviceInterface)cdi).Adapter,
                                                                        profile.MinReqs))
                {
                    sProfiles.Add(profile);
                    // decide which recommendation to use
                    profile.RecommendedVarInUse = -1;
                    for (int i = 0; i < profile.RecommendedVariations.Length; i++)
                    {
                        if (GraphicsDeviceManager.CheckAdapterMeetsRequirements(((CommonDeviceInterface)cdi).Adapter,
                                                                                profile.RecommendedVariations[i]))
                        {
                            profile.RecommendedVarInUse = i;
                            break;
                        }
                    }
                }
            }
            // TODO: This needs to feed back to UI?
            supportedProfiles = sProfiles.ToArray();
            if (supportedProfiles.Length == 0)
            {
                throw new Exception("None of the available graphics profiles meet the graphics devices capabilities");
            }
        }