예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            CursorVisible = true;
            VSync         = VSyncMode.Off;
            CreateProjection();

            _coloredSolidShader = new ShaderProgram(new Dictionary <ShaderType, string>
            {
                { ShaderType.VertexShader, "Components/Shaders/coloredVertex.vert" },
                { ShaderType.FragmentShader, "Components/Shaders/coloredVertex.frag" }
            }, 20, 21);

            _texturedSolidShader = new ShaderProgram(new Dictionary <ShaderType, string>
            {
                { ShaderType.VertexShader, "Components/Shaders/texturedVertex.vert" },
                { ShaderType.FragmentShader, "Components/Shaders/texturedVertex.frag" }
            }, 20, 21);

            _actorFactory = new ActorFactory(_coloredSolidShader, _texturedSolidShader);
            _player       = _actorFactory.CreateSpacecraft();

            _actors.AddRange(new IActor[]
            {
                _player,
                _actorFactory.CreateAsteroid(),
                _actorFactory.CreateGoldenAsteroid(),
                _actorFactory.CreateWoodenAsteroid()
            });

            GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
            GL.PatchParameter(PatchParameterInt.PatchVertices, 3);

            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.CullFace);
            Closed += (s, ce) => Exit();
        }