I want to DrawPixels through a buffer (I am trying to do that through PBO).
private void Init ()
{
GL.GenBuffers (1, buffers);
GL.BindBuffer (BufferTarget.PixelUnpackBuffer, buffers [0]);
GL.BufferData<byte> (BufferTarget.PixelUnpackBuffer, sizePtr, data, BufferUsageHint.StreamDraw);
}
protected override void RenderFrame ()
{
GL.DrawBuffer (DrawBufferMode.Front);
GL.BindBuffer (BufferTarget.PixelUnpackBuffer, buffers [0]);
GL.DrawPixels (w, h, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
}
I write on C#, but I hope it will be understandable for others.
I also tried another method.
private void Init ()
{
}
protected override void RenderFrame ()
{
GL.DrawPixels<byte> (w, h, PixelFormat.Bgra, PixelType.UnsignedByte, data);
}
And the result of this two approaches is absolutely the same. Why? In the firs one I don’t use CPU memory at all. What is the most fast method to copy to the frame buffer?