Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 14

Thread: Streaming video to OpenGl texture

Hybrid View

  1. #1
    Junior Member Regular Contributor
    Join Date
    Feb 2007
    Location
    Hungary
    Posts
    168

    Streaming video to OpenGl texture

    Hi,

    I would like to know if there is a better way to stream a video file (e.g. AVI) to an OpenGl texture than what one of the Nehe tutorials suggests (i.e using vfw and AVIStreamGetFrame).

    My problem with this is that a lot of codecs are not compatible with vfw and it is quite slow.

    Of course, I can do this with DirectX and stream the video to a DirectDraw surface then copy every frame from there to an OpenGl texture. But is there a way to make this copy inside GPU memory ('blit') and without involving a much more costly download from GPU than upload it back again?

    Thanks.

  2. #2
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: Streaming video to OpenGl texture

    The ARB_pixel_buffer_object extension seems to suit to your problem. With it, you can benefit from DMA and speed up your texture updates. See the exention spec for more information.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Feb 2007
    Location
    Hungary
    Posts
    168

    Re: Streaming video to OpenGl texture

    I am already using PBOs extensively, the problem is about decompressing a video file frame by frame. The vfw library the nehe tutorial suggests is straightforward, but most of the new codecs are not compatible and it is quite slow.

    DirectX is capable of streaming video to a DirectDraw surface, but if this requires an extra copy to transfer it to opengl, I would like to avoid reading it back from the GPU (DirectDraw surface) to PC memory then transferring it back via PBO to GPU memory. Are you sure this copy would happen inside the GPU?

    Thanks.

  4. #4
    Member Regular Contributor CrazyButcher's Avatar
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    401

    Re: Streaming video to OpenGl texture

    look into the nvidia opengl sdk, they have a sample of using directx decompressing to a PBO

    http://developer.download.nvidia.com...u_videoeffects

  5. #5
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: Streaming video to OpenGl texture

    You may want to read this if it is not already done and then check your pixel size and pixel format.

  6. #6
    Junior Member Regular Contributor
    Join Date
    Feb 2007
    Location
    Hungary
    Posts
    168

    Re: Streaming video to OpenGl texture

    Although I could not yet compile the nvidia sample, at first glance the contents of a frame of video is being passed to a directx surface (afaik the equivalent of an opengl texture) which is a - hopefully - asynchronous upload to the GPU, then being read back to PC RAM. Then, using PBOs it is uploaded again asynchronously to the GPU, this time to an opengl texture.

    This looks like two extra steps compared to if I used directx and not opengl. Even if all this is asynchronous on the CPU side it still requires an extra effort from the GPU and is an extra load on the bus.

    Am I mistaken in my assumptions? If not, is this still the best way to stream video to an opengl texture?

    Thanks,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •