使用openGL进行视频显示
我想直接用 OpenGL 显示非常高分辨率的视频。
图像数据将在 GPU 上进行处理,我希望避免往返 PC 以在基于标准位图的窗口中显示视频。
跨平台很好,只有 Windows 就可以了(只有 nvidia 也可以)
有人有任何关于执行此操作的方法的链接吗?
有一个糟糕的 NeHe 教程和一些 Qt 中嵌入式 openGL 小部件的示例,但我需要更好的性能和更大的图像。
I want to display very high resolution video directly with OpenGL.
The image 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
假设 OpenGL 2.1,使用 GL_PIXEL_UNPACK_BUFFER 类型的缓冲区对象将像素数据流式传输到纹理。它比每帧上传数据更快,因为当您使用 glMapBuffer、glMapBufferRange (OpenGL 3.2) 或直接调用 glBufferData 时,实现可能会使用 DMA 进行复制。您还可以在每个批次中复制多个帧,以在复制开销和映射开销之间进行权衡。最后,创建一个着色器将 YUV 或 YCbCr 转换为 RGB 并用三角形条带显示纹理。
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.
与 OpenGL 相关的最明显的事情是将位图显示为纹理。
The obvious thing to do with OpenGL would be to display the bitmap as a texture.
那么您想在纹理上发送视频并使用片段着色器对其进行处理吗? 这里一个简短的教程做类似的事情。这只是一个简单的 OpenGL 2.0 示例,它创建 2 个窗口大小的纹理并在片段着色器中混合它们。不涉及视频,但如果您已经有办法解码它,修改它应该不难。
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.