Video display with openGL
I want to display very high resolution video directly with OpenGL.
The ima开发者_Go百科ge data is going to be processed on the GPU and I want to avoid a round-trip back to the PC to show the video in a standard bitmap based window.
Cross platform is nice, Windows only would be OK (so would nvidia only)Anyone have any links to ways doing this?
There is a poor NeHe tutorial and a few examples for embedded openGL widgets in Qt but I need much better performance and much larger images.
Assuming OpenGL 2.1, use a buffer object of type GL_PIXEL_UNPACK_BUFFER to stream pixel data to a texture. It's faster than uploading data every frame as the implementation might use DMA for copying when you use glMapBuffer, glMapBufferRange (OpenGL 3.2) or call glBufferData directly. You can also copy several frames in each batch to get a tradeoff between copy-overhead and mapping overhead. Last, create a shader to convert YUV or YCbCr to RGB and display the texture with a triangle strip.
The obvious thing to do with OpenGL would be to display the bitmap as a texture.
So you want to send your video on a texture and process it with fragment shader? Here's one short tutorial how to do something similar. It's just a simple OpenGL 2.0 example that creates 2 window size textures and mixes them in fragment shader. There's no video involved but shouldn't be hard to modify if you already have means to decode it.
精彩评论