thomas.spranger's picture

[solved] Video as background in OpenGL

Hi guys,

I need a video behind a few OpenGL-objects. What's the best way to do? As a texture, or is there a possibility to make the background of the GLControl transparent (But only the background, not the objects)?

Thanks so far... Thomas


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Inertia's picture

[Insert name of favorite search engine here] is your friend. ;)

A transparent canvas is not the way to go. Try doing all video reading/decoding/texture uploads in a second context/thread and use the primary thread to cycle through textures of the video stream. (Don't decode only a single frame, preallocate something like 10 spare textures and cache ahead.)

sgsrules's picture

Also use PBOs when updating your textures. If you want your video to always be in the background clear your depth buffer before drawing anything else. If you need a good video library try ffmpeg you'll have to find a adequate .net wrapper or write your own.

thomas.spranger's picture

Thanks to both of you so far.

I'll give it a try. First I have to read something about PBOs; Sounds like a good solution.

thomas.spranger's picture

Well, it works so far. The only thing: It takes a lot of CPU-Usage. Does anyone of you know a sample using pbo's? I can't find something useful...

the Fiddler's picture

This is the PBO example I typically refer to: (just drop the "ARB" suffices).

thomas.spranger's picture

Thanks for the link. Very good description!
Unfortunatly the cpu-usage is still high. Maybe it comes from the video-source.

But thanks for the help to all

minuteman's picture

Hello Thomas,

could you share your solution here? I am really interested in how you managed the opengl overlay objects