コード例 #1
0
ファイル: MainWindow.cs プロジェクト: LidaTomsk2/CGraphics
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            base.OnRenderFrame(e);

            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            GL.ClearColor(0.3f, 0.5f, 0.9f, 0.0f);

            _camera.Update();
            _lightning.Draw();

            foreach (var drawable in _drawables)
            {
                drawable.Draw();
            }

            GL.Color3(Color.White);
            GL.Begin(BeginMode.Quads);
            for (int i = 0; i < 20; i++)
            {
                for (int j = 0; j < 20; j++)
                {
                    GL.Vertex3(-10 + j, 0, -10 + i);
                    GL.Vertex3(-10 + j + 1, 0, -10 + i);
                    GL.Vertex3(-10 + j + 1, 0, -10 + i + 1);
                    GL.Vertex3(-10 + j, 0, -10 + i + 1);
                }
            }

            GL.End();

            SwapBuffers();
        }
コード例 #2
0
    public void Draw()
    {
        if (Alpha <= 0)
        {
            return;
        }

        foreach (GameObject obj in ActiveLineObj)
        {
            Lightning lineComponent = obj.GetComponent <Lightning> ();
            lineComponent.SetColor(Tint * (Alpha * 0.6f));
            lineComponent.Draw();
        }
    }