OpenGL context

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Stu-e Offline
Member
Posts: 89
Joined: Jan 2010
Reputation: 1
Post: #1
Hi
I am experimenting with VDPAU/OpenGL interoperability in order to perform some simple video processing using textures and frame buffer objects. However my attempts so far have failed.

I suspect there might be a problem with OpenGL context. Can anyone suggest how I might be able to create a context local to the processing code where there is no need for a window or how I might share the existing context used for the VDPAU output to screen?

Thanks
find quote
Stu-e Offline
Member
Posts: 89
Joined: Jan 2010
Reputation: 1
Post: #2
Yup glGenTextures is returning zeroes so it's probably because there is no GL context.

Can anybody suggest how I can get access to a GL context from within CVDPAU::Decode()?

Thanks
find quote
Stu-e Offline
Member
Posts: 89
Joined: Jan 2010
Reputation: 1
Post: #3
Burnt my head a bit but I managed to generate a GLX pixel buffer and attach an OpenGL context to that, local to the code concerned.
I can now access OpenGL functions OK.
find quote
bobo1on1 Offline
cheapass Team-XBMC Developer
Posts: 2,758
Joined: Dec 2008
Reputation: 22
Post: #4
GL contexts are always attached to a single thread, if you want to do any image processing using OpenGL, I suggest doing it from the render thread.
find quote
Stu-e Offline
Member
Posts: 89
Joined: Jan 2010
Reputation: 1
Post: #5
That's tricky because I need to access VDPAU video surfaces before they go into the VDPAU video mixer.
I think that is on a different thread.

What parts of the code are covered by the render thread?

Although I did manage to create another OpenGL context for processing VDPAU video surfaces, it's very slow for some reason, dropping frames all over the place. I'm guessing there is no hardware acceleration but I don't know why.
find quote
FernetMenta Offline
Team-Kodi Developer
Posts: 3,643
Joined: Jul 2010
Reputation: 70
Location: Munich
Post: #6
I have redesigned vdpau and implemented vdpau/opengl interop (NV_vdpau_interop). For initialization vdpau creates its own gl context which shares textures with the main thread. This way vdpau is much less dependent on the render thread. https://github.com/xbmc/xbmc/pull/870
find quote
Stu-e Offline
Member
Posts: 89
Joined: Jan 2010
Reputation: 1
Post: #7
OK so you have clearly been down this road. Thanks for bringing your repo to my attention.
Should I download a copy of your master branch to test my video processing on?
find quote