示例#1
0
        public virtual void Initialize()
        {
            Console.WriteLine(GL.GetString(StringName.Version));
            Timer         = new Stopwatch();
            Camera        = new Camera();
            Shaders       = new Dictionary <string, Program>();
            ObjectManager = new MeshManager();
            Performance   = new Performance();
            Grid          = new CoordinateGrid();

            LoadDefaultShader();

            Camera.ViewProjectionMatrixChanged += Camera_ViewProjectionMatrixChanged;
            Camera.ViewMatrixChanged           += Camera_ViewMatrixChanged;
            Camera.Viewport.ViewportChanged    += Viewport_ViewportChanged;

            OpenGL.ReportError();
            GL.ClearColor(Colours.Green);
            OpenGL.ReportError();
            GL.FrontFace(FrontFaceDirection.Ccw);
            OpenGL.ReportError();
            GL.Enable(EnableCap.CullFace);
            OpenGL.ReportError();
            GL.Enable(EnableCap.DepthTest);
            OpenGL.ReportError();
        }
示例#2
0
        private void Initialization(object sender, EventArgs e)
        {
            Console.WriteLine(GL.GetString(StringName.Version));
            DebugDrawer.debugProgram = system_program;

            this.camera = new Camera();
            this.timer = new Stopwatch();
            this.grid = new CoordinateGrid();
            this.mousePole = new MousePole2D(camera);
            OpenGL.ReportError();

            this.BackColor = Colours.ClearColour;
            ActiveCamera = camera;

            this.camera.ViewProjectionMatrixChanged += viewport_ProjectionChanged;
            this.camera.ViewMatrixChanged += camera_ViewMatrixChanged;
            this.camera.CameraUpdated += mousePole.OnCameraUpdate;

            this.glControl1.MouseMove += camera.OnMouseMove;
            this.glControl1.MouseDown += camera.OnMouseDown;
            this.glControl1.MouseUp += camera.OnMouseUp;
            this.glControl1.MouseCaptureChanged += camera.OnMouseCaptureChanged;

            InitializeOpenGL();

            this.manager = new MeshManager(program, system_program);

            timer.Start();
            //  firing this method is meant to load the view-projection matrix values into 
            //  the shader uniforms, and initalizes the camera
            glControl1_Resize(this, new EventArgs());
        }