Example #1
0
            protected override unsafe void OnLoad(EventArgs e)
            {
                LoadTex();

                var green = new Texture("green.png");
                var red   = new Texture("red.png");

                {
                    batch = new QuadBatch <SpriteProgram, SpriteData, SpriteVertex>(4);
                    batch.Shader.Make(new Vector2(800, 800), new Vector2(338, 338), green, red);

                    batch.AddQuad(new SpriteData(new Rectangle(new Point(0, 0), new Size(200, 200)), new Rectangle(new Point(0, 0), new Size(200, 200))));
                    batch.AddQuad(new SpriteData(new Rectangle(new Point(300, 0), new Size(200, 200)), new Rectangle(new Point(100, 100), new Size(200, 200))));
                    batch.UpdateGpu();
                }
                {
                    batch2 = new QuadBatch <SpriteProgram, SpriteData, SpriteVertex>(4);
                    batch2.Shader.Make(new Vector2(800, 800), new Vector2(338, 338), red, green);

                    batch2.AddQuad(new SpriteData(new Rectangle(new Point(0, 300), new Size(200, 200)), new Rectangle(new Point(0, 0), new Size(200, 200))));
                    batch2.AddQuad(new SpriteData(new Rectangle(new Point(300, 300), new Size(200, 200)), new Rectangle(new Point(100, 100), new Size(200, 200))));
                    batch2.UpdateGpu();
                }

                watch.Start();
                // random final setup
                {
                    //var x = GLFW.SetMouseButtonCallback;

                    VSync = VSyncMode.Adaptive;
                    GL.FrontFace(FrontFaceDirection.Cw);
                    GL.PolygonMode(MaterialFace.Back, PolygonMode.Line); // make draw with lines if drawing backs
                    //GL.ClearColor(0.0f, 0.0f, 1.0f, 0.0f); // set clear color
                }
                int total = 0;

                for (int currentNumber = 1; currentNumber < 1000; currentNumber++)
                {
                    int  iMod3          = currentNumber % 3;
                    int  iMod5          = currentNumber % 5;
                    bool isDivisibleBy3 = iMod3 == 0;
                    bool isDivisibleBy5 = iMod5 == 0;
                    if (isDivisibleBy3 || isDivisibleBy5)
                    {
                        total += currentNumber;
                    }
                }
                base.OnLoad(e);

                transform = Matrix4.CreateTranslation(new Vector3(100, 10, 0));
            }