Ejemplo n.º 1
0
        /// <summary>
        /// Binds the array buffer attached to.
        /// </summary>
        /// <param name='index'>
        /// Index.
        /// </param>
        /// <exception cref='InvalidOperationException'>
        /// Is thrown when an operation cannot be performed.
        /// </exception>
        public void Begin(GraphicsContext ctx, PrimitiveType primitive)
        {
            CheckThisExistence(ctx);

            // Make this feedback buffer current
            Bind(ctx);

            // Begin transform feedback
            switch (primitive)
            {
            case PrimitiveType.Points:
                Gl.BeginTransformFeedback((int)PrimitiveType.Points);
                break;

            case PrimitiveType.Lines:
            case PrimitiveType.LineStrip:
            case PrimitiveType.LineLoop:
                Gl.BeginTransformFeedback((int)PrimitiveType.Lines);
                break;

            case PrimitiveType.Triangles:
            case PrimitiveType.TriangleStrip:
            case PrimitiveType.TriangleFan:
                Gl.BeginTransformFeedback((int)PrimitiveType.Triangles);
                break;

            default:
                throw new InvalidOperationException();
            }

            // Disable rasterizer?
            if (EnableRasterizer == false)
            {
                Gl.Enable(EnableCap.RasterizerDiscard);
            }

            // Start queries
            _PrimitivesGenerated.Begin(ctx);
            _PrimitivesWritten.Begin(ctx);
        }