public void MatrixMul2() { ProjectionMatrix proj = new OrthoProjectionMatrix(-1.0f, 0.5f, 0.0f, 1.0f, 0.1f, 3.0f); ModelMatrix model = new ModelMatrix(); model.Translate(2.0f, -4.0f, 1.125f); model.RotateX(30.0f); Matrix r1 = proj * model; Matrix m = new Matrix(proj.ToArray(), 4, 4), n = new Matrix(model.ToArray(), 4, 4); Matrix r2 = m * n; }
private void Es2_Render() { OrthoProjectionMatrix projectionMatrix = new OrthoProjectionMatrix(0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f); Gl.UseProgram(_Es2_Program); using (MemoryLock arrayPosition = new MemoryLock(_ArrayPosition)) using (MemoryLock arrayColor = new MemoryLock(_ArrayColor)) { Gl.VertexAttribPointer((uint)_Es2_Program_Location_aPosition, 2, VertexAttribType.Float, false, 0, arrayPosition.Address); Gl.EnableVertexAttribArray((uint)_Es2_Program_Location_aPosition); Gl.VertexAttribPointer((uint)_Es2_Program_Location_aColor, 3, VertexAttribType.Float, false, 0, arrayColor.Address); Gl.EnableVertexAttribArray((uint)_Es2_Program_Location_aColor); Gl.UniformMatrix4(_Es2_Program_Location_uMVP, false, projectionMatrix.ToArray()); Gl.DrawArrays(PrimitiveType.Triangles, 0, 3); } }
private static void Draw() { OrthoProjectionMatrix projectionMatrix = new OrthoProjectionMatrix(0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f); Gl.Viewport(0, 0, 1920, 1080); Gl.Clear(ClearBufferMask.ColorBufferBit); Gl.UseProgram(_Es2_Program); using (MemoryLock arrayPosition = new MemoryLock(_ArrayPosition)) using (MemoryLock arrayColor = new MemoryLock(_ArrayColor)) { Gl.VertexAttribPointer((uint)_Es2_Program_Location_aPosition, 2, VertexAttribType.Float, false, 0, arrayPosition.Address); Gl.EnableVertexAttribArray((uint)_Es2_Program_Location_aPosition); Gl.VertexAttribPointer((uint)_Es2_Program_Location_aColor, 3, VertexAttribType.Float, false, 0, arrayColor.Address); Gl.EnableVertexAttribArray((uint)_Es2_Program_Location_aColor); Gl.UniformMatrix4(_Es2_Program_Location_uMVP, 1, false, projectionMatrix.ToArray()); Gl.DrawArrays(PrimitiveType.Triangles, 0, 3); } }
private void RenderControl_Render(object sender, GlControlEventArgs e) { Control control = (Control)sender; OrthoProjectionMatrix projectionMatrix = new OrthoProjectionMatrix(0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f); Gl.Viewport(0, 0, control.Width, control.Height); Gl.Clear(ClearBufferMask.ColorBufferBit); Gl.UseProgram(_Es2_Program); using (MemoryLock arrayPosition = new MemoryLock(_ArrayPosition)) using (MemoryLock arrayColor = new MemoryLock(_ArrayColor)) { Gl.VertexAttribPointer((uint)_Es2_Program_Location_aPosition, 2, Gl.FLOAT, false, 0, arrayPosition.Address); Gl.EnableVertexAttribArray((uint)_Es2_Program_Location_aPosition); Gl.VertexAttribPointer((uint)_Es2_Program_Location_aColor, 3, Gl.FLOAT, false, 0, arrayColor.Address); Gl.EnableVertexAttribArray((uint)_Es2_Program_Location_aColor); Gl.UniformMatrix4(_Es2_Program_Location_uMVP, 1, false, projectionMatrix.ToArray()); Gl.DrawArrays(PrimitiveType.Triangles, 0, 3); } }