Ejemplo n.º 1
0
 public River()
 {
     water = new TextureElement("water1.jpg");
     water.Scale(1.0f);
     water.RotateShape(Vector3.UnitX, 45f);
     water.Move(0f, -0.8f, 0f);
 }
Ejemplo n.º 2
0
        protected override void init()
        {
            watchdog = new System.Windows.Forms.Timer();
            watchdog.Interval = 1000;
            watchdog.Tick += Quit;
            watchdog.Enabled = true;
            watchdog.Start();
            Bitmap bitmap1 = new Bitmap(512, 512, System.Drawing.Imaging.PixelFormat.Format4bppIndexed);
            Bitmap bitmap2 = new Bitmap(512, 512, System.Drawing.Imaging.PixelFormat.Format4bppIndexed);
            byte[] bitmap1data = new byte[256 * 512];
            byte[] bitmap2data = new byte[256 * 512];
            for (int i = 0; i < 256; i++)
            {
                for (int j = 0; j < 512; j++)
                {
                    bitmap1data[j * 256 + i] = (byte)(4 * (j / 128) + i / 64);
                }
            }
            FillBitmap(bitmap1, bitmap1data);
            image1 = new TextureElement(bitmap1);
            image2 = new TextureElement(bitmap2);

            Worker workerObject = new Worker();
            Thread workerThread = new Thread(workerObject.DoWork);
            workerThread.Start();
        }
        protected override void init()
        {
            g_fzNear = 1.0f;
            g_fzFar = 1000.0f;
            InitializePrograms();

            try
            {
                string XmlFilesDirectory = GlsTutorialsClass.ProjectDirectory + @"/XmlFilesForMeshes";
                Stream corridor = File.OpenRead(XmlFilesDirectory + @"/corridor.xml");
                g_pCorridor = new Mesh(corridor);
                Stream plane = File.OpenRead(XmlFilesDirectory + @"/bigplane.xml");
                g_pPlane = new Mesh(plane);
            }
            catch(Exception ex)
            {
                MessageBox.Show("Error creating meshes " + ex.ToString());
            }

            SetupDepthAndCull();

            LoadCheckerTexture();
            LoadMipmapTexture();
            CreateSamplers();

            textureSphereProgram = ts.GetProgram();
            ts.SetProgram(manyImageProgram);

            te = new TextureElement("wood4_rotate.png");
            textureElementProgram = te.GetProgram();
            te.SetProgram(manyImageProgram);
            textureElementTexture = te.GetTexture();
            te.Scale(new Vector3(0.4f, 0.4f, 10f));
            te.RotateShape(Vector3.UnitX, 45f);
        }
 private void SetTextures()
 {
     image1 = new TextureElement(SampleTextures.GetBitmapSquares(squaresize, squaresize, color1, color2));
     image2 = new TextureElement(SampleTextures.GetBitmapSquares(squaresize, squaresize, color2, color1));
 }