Search code examples
c++openglstreamingpixel

Modern way to stream pixels to OpenGL?


I have a system that composites 5 megapixel images in real-time. Everything works, but I want to visualize my feed with an OpenGL program.

What is the best way to draw a char* of rgb to the screen? I was hoping to use OpenGL to perform GPU interop, although any suggestions as to platform would also help.

There is a simliar post here OpenGL - draw pixels to screen? but it seems that the method is dated and link to glDrawPixels is dead.


Solution

  • copied from my previous answer: How to cancel a blocking OpenGL call

    instead of glDrawPixels you could use PixelBufferObjects which are not blocking. glDrawPixels will wait (in your main thread) until whole pixel transfer is finished, but PBO will continue...

    http://www.songho.ca/opengl/gl_pbo.html

    http://www.opengl.org/wiki/Pixel_Buffer_Object

    if you need some more advanced calculations then you may want to use OpenCL, that will give you more flexibility.