Exemple #1
0
        protected override void OnRenderFrame(object sender, FrameEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }
            // Clear the used buffer to paint a new frame onto it
            GL.Clear(ClearBufferMask.ColorBufferBit);
            // Declare that we will use this program
            //GL.UseProgram(_window.ColoredProgram);
            // Get projection matrix and make shaders to compute with this matrix
            Matrix4 projection = GetProjection();

            _line?.Render(ref projection);
            _freq1Slider.Render(ref projection);
            _freq2Slider.Render(ref projection);
            _timeSlider.Render(ref projection);
            freq1Text.Render(ref projection);
            freq2Text.Render(ref projection);
            ScreenTimeText.Render(ref projection);
            foreach (var button in _buttons.Values)
            {
                button.Render(ref projection);
            }

            _window.SwapBuffers();
        }
        public virtual void Render(ICamera camera)
        {
            _model.Bind();
            var t2 = Matrix4.CreateTranslation(_position.X, _position.Y, _position.Z);
            var r1 = Matrix4.CreateRotationX(_rotation.X);
            var r2 = Matrix4.CreateRotationY(_rotation.Y);
            var r3 = Matrix4.CreateRotationZ(_rotation.Z);
            var s  = Matrix4.CreateScale(_scale);

            _modelView = r1 * r2 * r3 * s * t2 * camera.LookAtMatrix;
            GL.UniformMatrix4(21, false, ref _modelView);
            _model.Render();
        }