/// <summary>
 /// Virtual Unbind implementation.
 /// </summary>
 /// <param name="ctx">
 /// A <see cref="GraphicsContext"/> used for binding.
 /// </param>
 protected override void UnbindCore(GraphicsContext ctx)
 {
     if (ctx.Caps.GlExtensions.TransformFeedback2_ARB)
     {
         // Bind this  feedback buffer
         Gl.BindTransformFeedback(Gl.TRANSFORM_FEEDBACK, InvalidObjectName);
     }
     else
     {
         base.UnbindCore(ctx);
     }
 }
예제 #2
0
        /// <summary>
        /// Bind this BufferObject.
        /// </summary>
        internal override void Bind(GraphicsContext ctx)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException("ctx");
            }

            if (ctx.Caps.GlExtensions.TransformFeedback2_ARB)
            {
                // Bind this feedback buffer
                Gl.BindTransformFeedback(Gl.TRANSFORM_FEEDBACK, ObjectName);
            }
            else
            {
                base.Bind(ctx);
                MapBufferObjects(ctx);
            }
        }
예제 #3
0
        /// <summary>
        /// Actually create this GraphicsResource resources.
        /// </summary>
        /// <param name="ctx">
        /// A <see cref="GraphicsContext"/> used for allocating resources.
        /// </param>
        protected override void CreateObject(GraphicsContext ctx)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException("ctx");
            }
            if (_AttachedArrays.Count == 0)
            {
                throw new InvalidOperationException("no feedback attachments");
            }

            if (ctx.Caps.GlExtensions.TransformFeedback2_ARB)
            {
                // Bind/create feedback buffer
                Gl.BindTransformFeedback(Gl.TRANSFORM_FEEDBACK, ObjectName);

                // Define feedback buffer
                MapBufferObjects(ctx);

                // Reset feedback target binding
                Gl.BindTransformFeedback(Gl.TRANSFORM_FEEDBACK, 0);
            }
            else
            {
                Bind(ctx);

                // Define feedback buffer
                MapBufferObjects(ctx);
            }

            // Create queries
            _PrimitivesGenerated = new QueryObject(QueryTarget.PrimitivesGenerated);
            _PrimitivesGenerated.Create(ctx);

            _PrimitivesWritten = new QueryObject(QueryTarget.TransformFeedbackPrimitivesGenerated);
            _PrimitivesWritten.Create(ctx);
        }
예제 #4
0
        /// <summary>
        /// Unbind this BufferObject.
        /// </summary>
        internal override void Unbind(GraphicsContext ctx)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException("ctx");
            }

            if (ctx.Caps.GlExtensions.TransformFeedback2_ARB)
            {
                // Bind this  feedback buffer
                Gl.BindTransformFeedback(Gl.TRANSFORM_FEEDBACK, 0);
            }
#if false
            else
            {
                // Manually map buffer objects
                foreach (KeyValuePair <uint, ArrayAttachment> pair in mAttachedArrays)
                {
                    Gl.BindBufferBase(Gl.TRANSFORM_FEEDBACK_BUFFER, pair.Key, 0);
                    RenderException.DebugCheckErrors();
                }
            }
#endif
        }