4

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.

4
  • I've fixed that link. Yes, it's dated and it's been removed in new API (which is why the link got broken in the first place)
    – Kos
    Feb 1, 2013 at 19:02
  • 3
    About your question, have you tried to simply make a texture and update it via glTexSubImage2D?
    – Kos
    Feb 1, 2013 at 19:03
  • @Kos I am currently trying a few experiments, but I feel this is solved problem. I don't like the idea of having a box with a texture rendered on it because I feel that there is computational inefficiency going from model coordinates to the view port coordinates. If this handled in hardware it guess it doesn't matter. Finally, I am not sure about the DMA which is important as my application is currently consuming a Xeon X7560
    – Mikhail
    Feb 1, 2013 at 19:51
  • 2
    @Mikhail: "I don't like the idea of having a box with a texture rendered on it because I feel that there is computational inefficiency going from model coordinates to the view port coordinates." – actually drawing a textured quad is the most efficient way to splat images to the OpenGL framebuffer. It allows the GPU to use texture caches and fetch hardware. I know, it's counterintuitive, but that's how it is. You mentioned "interop". If you're using OpenCL or CUDA, you can write into a texture object directly.
    – datenwolf
    Feb 1, 2013 at 19:58

1 Answer 1

2

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.

4
  • 1
    Are pixel buffer objects modern?
    – Mikhail
    Feb 23, 2013 at 23:58
  • good question, but I think they are modern. PBO was introduced in opengl 2.1 (so this is old), but they add modern usage to the opengl - that means using buffers. I do not know if there is something better to use (even with opengl 4.3) right now.
    – fen
    Feb 24, 2013 at 10:31
  • I guess you are correct, it might not be the most advanced way but it is certainly not obsolete.
    – Mikhail
    Feb 25, 2013 at 23:46
  • you can check OpenCL, maybe it has some better way of streaming data to the GPU, but it is "outside" of OpenGL.
    – fen
    Feb 26, 2013 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.