Пример #1
0
 private void OnLoad(object sender, EventArgs e)
 {
     // maximize window
     WindowState = WindowState.Maximized;
     // load program
     _programOdd   = ProgramFactory.Create <GeodesicProgramOdd>();
     _programEqual = ProgramFactory.Create <GeodesicProgram>();
     _program      = _programOdd;
     // create icosahedron and set model matrix
     _modelMatrix = Matrix4.CreateScale(1);
     _icosahedron = new Icosahedron(5);
     _icosahedron.UpdateBuffers();
     // bind it to an vao
     _vao = new VertexArray();
     _vao.Bind();
     _vao.BindElementBuffer(_icosahedron.IndexBuffer);
     _vao.BindAttribute(_program.Position, _icosahedron.VertexBuffer);
     // set some reasonable default state
     GL.ClearColor(Color4.Black);
     GL.Enable(EnableCap.DepthTest);
     // backface culling is done in the tesselation control shader
     GL.Enable(EnableCap.CullFace);
     GL.CullFace(CullFaceMode.Back);
     GL.PatchParameter(PatchParameterInt.PatchVertices, 3);
     // lighting stuff
     _deferredRenderer = new DeferredRenderer();
     // enable controls
     _variableHandler.Enable(this);
 }