Beispiel #1
0
            public RenderVertexBufferHelper(GSVertexBuffer vb)
            {
                this.vb = vb;
                if (vb == null)
                {
                    return;
                }

                GS.RenderStart(true);
            }
Beispiel #2
0
        public static unsafe void LoadVertexBuffer(GSVertexBuffer vertexBuffer)
        {
            IntPtr ptr = IntPtr.Zero;

            if (vertexBuffer != null)
            {
                ptr = vertexBuffer.GetPointer();
            }

            libobs.gs_load_vertexbuffer(ptr);
        }
Beispiel #3
0
        public static unsafe GSVertexBuffer RenderSave()
        {
            IntPtr ptr = libobs.gs_render_save();

            if (ptr == null)
            {
                return(null);
            }

            GSVertexBuffer vb = new GSVertexBuffer(ptr);

            return(vb);
        }
Beispiel #4
0
            public void Dispose()
            {
                if (vb == null)
                {
                    return;
                }

                GSVertexBuffer newvb = GS.RenderSave();

                // transfer the internal pointer to old object
                vb.Dispose();
                vb.instance = newvb.instance;

                newvb.instance = IntPtr.Zero;
                newvb.Dispose();
            }
Beispiel #5
0
            public RenderVertexBufferHelper(GSVertexBuffer vb)
            {
                this.vb = vb;
                if (vb == null)
                    return;

                GS.RenderStart(true);
            }
Beispiel #6
0
 /// <summary>
 /// Render data to vertex buffer, used with using pattern (RAII).
 /// Calls RenderStart, and RenderSave at the end of the using block.
 /// </summary>
 ///	<example>
 /// GSVertexBuffer vb = new GSVertexBuffer();
 /// using (GS.RenderVertexBuffer(vb))
 /// {
 ///		...
 /// }
 /// </example>
 public static RenderVertexBufferHelper RenderVertexBuffer(GSVertexBuffer vb)
 {
     return new RenderVertexBufferHelper(vb);
 }
Beispiel #7
0
        public static unsafe GSVertexBuffer RenderSave()
        {
            IntPtr ptr = libobs.gs_render_save();
            if (ptr == null)
                return null;

            GSVertexBuffer vb = new GSVertexBuffer(ptr);
            return vb;
        }
Beispiel #8
0
        public static unsafe void LoadVertexBuffer(GSVertexBuffer vertexBuffer)
        {
            IntPtr ptr = IntPtr.Zero;

            if (vertexBuffer != null)
                ptr = vertexBuffer.GetPointer();

            libobs.gs_load_vertexbuffer(ptr);
        }
Beispiel #9
0
 /// <summary>
 /// Render data to vertex buffer, used with using pattern (RAII).
 /// Calls RenderStart, and RenderSave at the end of the using block.
 /// </summary>
 ///	<example>
 /// GSVertexBuffer vb = new GSVertexBuffer();
 /// using (GS.RenderVertexBuffer(vb))
 /// {
 ///		...
 /// }
 /// </example>
 public static RenderVertexBufferHelper RenderVertexBuffer(GSVertexBuffer vb)
 {
     return(new RenderVertexBufferHelper(vb));
 }
Beispiel #10
0
        private void InitPrimitives()
        {
            using (GS.GraphicsContext())
            {
                // box from vertices
                boxPrimitive = new GSVertexBuffer();
                using (GS.RenderVertexBuffer(boxPrimitive))
                {
                    GS.Vertex2f(0.0f, 0.0f);
                    GS.Vertex2f(0.0f, 1.0f);
                    GS.Vertex2f(1.0f, 1.0f);
                    GS.Vertex2f(1.0f, 1.0f);
                    GS.Vertex2f(1.0f, 0.0f);
                    GS.Vertex2f(0.0f, 0.0f);
                }

                // circle from vertices
                circlePrimitive = new GSVertexBuffer();
                using (GS.RenderVertexBuffer(circlePrimitive))
                {
                    for (int i = 0; i <= 360; i += 360 / 20)
                    {
                        double pos = Math.PI * (double)i / 180.0;
                        GS.Vertex2f((float)Math.Cos(pos), (float)Math.Sin(pos));
                    }
                }
            }
        }
 public void Load(GSVertexBuffer vertexBuffer)
 {
     libobs.gs_load_vertexbuffer(vertexBuffer.GetPointer());
 }
 public void Flush(GSVertexBuffer vertexBuffer)
 {
     libobs.gs_vertexbuffer_flush(vertexBuffer.GetPointer());
 }
 public void Flush(GSVertexBuffer vertexBuffer)
 {
     libobs.gs_vertexbuffer_flush(vertexBuffer.GetPointer());
 }
 public void Load(GSVertexBuffer vertexBuffer)
 {
     libobs.gs_load_vertexbuffer(vertexBuffer.GetPointer());
 }