public void Init(object sender, OpenGLEventArgs args) { SceneControl = sender as OpenGLControlJOG; // Set up the view. MvpBuilder.FovRadians = (float)Math.PI / 2f; // Set FOV to 90° MvpBuilder.Far = 100f; MvpBuilder.Near = 0.01f; MvpBuilder.Width = (int)SceneControl.ActualWidth; MvpBuilder.Height = (int)SceneControl.ActualHeight; MvpBuilder.TranslationZ = -10; MvpBuilder.BuildPerspectiveProjection(); MvpBuilder.BuildTurntableModelview(); // Create a shader program. NmProgram = new NormalMaterialProgram(GL); ProjectionMatrix = MvpBuilder.ProjectionMatrix; ModelviewMatrix = MvpBuilder.ModelviewMatrix; NormalMatrix = mat3.identity(); NmProgram.LightPosition = new vec3(5, 10, 15); //AddMonkey(); //AddTestData(GL); GL.Enable(OpenGL.GL_DEPTH_TEST); GL.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT); }
public void Resized(object sender, OpenGLEventArgs args) { var control = sender as OpenGLControlJOG; MvpBuilder.Width = (int)control.ActualWidth; MvpBuilder.Height = (int)control.ActualHeight; MvpBuilder.BuildPerspectiveProjection(); ProjectionMatrix = MvpBuilder.ProjectionMatrix; }
public void RefreshProjection() { MvpBuilder.BuildPerspectiveProjection(); ProjectionMatrix = MvpBuilder.ProjectionMatrix; }
public void RefreshModelview() { MvpBuilder.BuildTurntableModelview(); ModelviewMatrix = MvpBuilder.ModelviewMatrix; }