public bool InitMdx()
        {
            Dev = new Device(MdxRender.DeviceInfo.default_adapter, DeviceType.Hardware,
                             MdxRender.DeviceInfo.renderWin, MdxRender.DeviceInfo.flags, MdxRender.DeviceInfo.pp);

            MdxRender.SM    = new ShaderManager();
            MdxRender.MM    = new ModelManager();
            MdxRender.Input = new InputManager();
            SelectTool.InitializeHandleModel();
            SelectionBox.Initialize();
            ProjectManager.MapSpawns.InitDebug();
            ShaderBase.InitializeDebug();
            mapViewButton = new RenderButton();
            //mapViewButton.Width = MdxRender.DeviceInfo.renderWin.Width;
            //mapViewButton.Height = MdxRender.DeviceInfo.renderWin.Height;
            mapViewButton.Initialize(35, 35, 15, 40);

            //set up lights that don't work
            SetupLights();

            whiteMaterial         = new Material();
            whiteMaterial.Ambient = Color.White;
            whiteMaterial.Diffuse = Color.White;
            //whiteMaterial.Emissive = Color.White;

            //Set up texture filtering to get rid of blocky uglies
            MdxRender.Dev.SamplerState[0].MagFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[0].MinFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[0].MipFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[1].MagFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[1].MinFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[1].MipFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[2].MagFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[2].MinFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[2].MipFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[3].MagFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[3].MinFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[3].MipFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[4].MagFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[4].MinFilter = TextureFilter.Linear;
            MdxRender.Dev.SamplerState[4].MipFilter = TextureFilter.Linear;

            MdxRender.Dev.RenderState.AlphaFunction = Compare.GreaterEqual;
            MdxRender.Dev.SetRenderState(RenderStates.ReferenceAlpha, 0x80);
            //UpdateGammaCorrection();

            //disable vsync, might get some tearing
            MdxRender.Dev.PresentationParameters.PresentationInterval = PresentInterval.Immediate;

            MdxRender.lightmapDebugger          = new GrenLightmapDebug();
            MdxRender.Dev.RenderState.PointSize = 10.0f;

            MdxRender.Dev.RenderState.CullMode      = Cull.CounterClockwise;
            MdxRender.Dev.RenderState.ZBufferEnable = true;
            MdxRender.Dev.DeviceResizing           += new System.ComponentModel.CancelEventHandler(device_DeviceResizing);
            MdxRender.Dev.DeviceReset += new EventHandler(device_DeviceReset);

            //Device.IsUsingEventHandlers = false;

            // Initialize the font
            m_fontFPS  = new D3D.Font(Dev, new Font("Arial", 12, FontStyle.Bold));
            consoleFPS = new D3D.Font(Dev, new Font("Arial", 10, FontStyle.Bold));

            // Initialize the camera placement and orientation
            Camera = new Camera();
            Camera.SetLookAt(new Vector3(-18, 0, 0), new Vector3());

            PreviewManager.Debug_LoadTestMesh();
            m_ready = true;

            return(false);
        }