예제 #1
0
        public override void Render(Camera camera, double t)
        {
            vao.Begin();

            normals_shader.Begin();
            normals_shader.SetUniforms(camera);
            GL.DrawArrays(PrimitiveType.Points, 0, length);
            normals_shader.End();

            points_shader.Begin();
            points_shader.SetUniforms(camera);
            GL.DrawArrays(PrimitiveType.Points, 0, length);
            points_shader.End();

            vao.End();
        }
예제 #2
0
        private void Initialize()
        {
            var vertices = new[] {
                new VertexPositionColor(new Vector3(-1, -1, 0), new Vector3(1, 0, 0)),
                new VertexPositionColor(new Vector3(1, -1, 0), new Vector3(0, 1, 0)),
                new VertexPositionColor(new Vector3(-1, 1, 0), new Vector3(0, 0, 1)),
                new VertexPositionColor(new Vector3(1, 1, 0), new Vector3(1, 1, 1))
            };

            vao = vertices.ToVertexArray();
            //vao = Factory<VertexPositionColor>.CreateVertexArray(vertices);

            shader = Factory <VertexPositionColor> .CreateShaderProgram(
                new VertexShaders.PositionColor(),
                new FragmentShaders.Color());

            shader.Begin();
            vao.Begin();
        }