/// <summary>
        /// Create Direct3D device and swap chain
        /// </summary>
        protected void InitDevice()
        {
            device    = D3DDevice1.CreateDeviceAndSwapChain1(directControl.Handle);
            swapChain = device.SwapChain;

            SetViews();

            // Create the effect
            using (FileStream effectStream = File.OpenRead("Tutorial07.fxo"))
            {
                effect = device.CreateEffectFromCompiledBinary(effectStream);
            }

            // Obtain the technique
            technique = effect.GetTechniqueByName("Render");

            // Obtain the variables
            worldVariable      = effect.GetVariableByName("World").AsMatrix;
            viewVariable       = effect.GetVariableByName("View").AsMatrix;
            projectionVariable = effect.GetVariableByName("Projection").AsMatrix;
            meshColorVariable  = effect.GetVariableByName("vMeshColor").AsVector;
            diffuseVariable    = effect.GetVariableByName("txDiffuse").AsShaderResource;

            InitVertexLayout();
            InitVertexBuffer();
            InitIndexBuffer();

            // Set primitive topology
            device.IA.PrimitiveTopology = PrimitiveTopology.TriangleList;

            // Load the Texture
            textureRV = TextureLoader.LoadTexture(device, "seafloor.png");

            InitMatrices();

            diffuseVariable.Resource = textureRV;
            needsResizing            = false;
        }
        /// <summary>
        /// Create Direct3D device and swap chain
        /// </summary>
        protected void InitDevice()
        {
            device = D3DDevice1.CreateDeviceAndSwapChain1(directControl.Handle);
            swapChain = device.SwapChain;

            SetViews();

            // Create the effect
            using (FileStream effectStream = File.OpenRead("Tutorial07.fxo"))
            {
                effect = device.CreateEffectFromCompiledBinary(effectStream);
            }

            // Obtain the technique
            technique = effect.GetTechniqueByName("Render");

            // Obtain the variables
            worldVariable = effect.GetVariableByName("World").AsMatrix;
            viewVariable = effect.GetVariableByName("View").AsMatrix;
            projectionVariable = effect.GetVariableByName("Projection").AsMatrix;
            meshColorVariable = effect.GetVariableByName("vMeshColor").AsVector;
            diffuseVariable = effect.GetVariableByName("txDiffuse").AsShaderResource;

            InitVertexLayout();
            InitVertexBuffer();
            InitIndexBuffer();

            // Set primitive topology
            device.IA.PrimitiveTopology = PrimitiveTopology.TriangleList;

            // Load the Texture
            textureRV = TextureLoader.LoadTexture(device, "seafloor.png");

            InitMatrices();

            diffuseVariable.Resource = textureRV;
            needsResizing = false;
        }