Example #1
0
        public bool Initialize(SystemConfiguration configuration, IntPtr windowHandle)
        {
            try
            {
                // Create the Direct3D object.
                D3D = new DX11();
                // Initialize the Direct3D object.
                if (!D3D.Initialize(configuration, windowHandle))
                {
                    return(false);
                }

                // Create the camera object
                Camera = new Camera();

                // Set the initial position of the camera.
                Camera.SetPosition(0, 0, -10);

                // Create the texture shader object.
                TextureShader = new TextureShader();

                // Initialize the texture shader object.
                if (!TextureShader.Initialize(D3D.Device, windowHandle))
                {
                    MessageBox.Show("Could not initialize the texture shader object.");
                    return(false);
                }

                // Create the bitmap object.
                Bitmap = new Bitmap();

                // Initialize the bitmap object.
                if (!Bitmap.Initialize(D3D.Device, configuration.Width, configuration.Height, "seafloor.dds", 256, 256))
                {
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Could not initialize Direct3D\nError is '" + ex.Message + "'");
                return(false);
            }
        }
Example #2
0
        public bool Initialize(SystemConfiguration configuration, IntPtr windowHandle)
        {
            try
            {
                // Create the Direct3D object.
                D3D = new DX11();
                // Initialize the Direct3D object.
                if (!D3D.Initialize(configuration, windowHandle))
                    return false;

                // Create the camera object
                Camera = new Camera();

                // Set the initial position of the camera.
                Camera.SetPosition(0, 0, -10);

                // Create the texture shader object.
                TextureShader = new TextureShader();

                // Initialize the texture shader object.
                if (!TextureShader.Initialize(D3D.Device, windowHandle))
                {
                    MessageBox.Show("Could not initialize the texture shader object.");
                    return false;
                }

                // Create the bitmap object.
                Bitmap = new Bitmap();

                // Initialize the bitmap object.
                if(!Bitmap.Initialize(D3D.Device, configuration.Width, configuration.Height, "seafloor.dds", 256, 256))
                    return false;

                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Could not initialize Direct3D\nError is '" + ex.Message + "'");
                return false;
            }
        }