heisters / libglvideo

Simple cross-platform MP4/MOV video player for use with OpenGL
Other
28 stars 5 forks source link

Black boxes when rendering text, possible GL conflict? #5

Open mattfelsen opened 5 years ago

mattfelsen commented 5 years ago

We (at Bluecadet) have been seeing an issue where rendering text (with GDI+) while a movie is playing causes the text to occasionally produce a black image instead. As I write this, I realize I haven't looked into whether the pixel data produced by the render looks ok but the texture is affected, or if the pixel data itself is already zeroed out. In any case, I poked around in a few classes (Movie & Context mostly) to see if anything was touching OpenGL state or similar, but I didn't see anything relevant. Does seeing this screenshot or hearing about this give you any thoughts or things to look into?

BlackBox

heisters commented 5 years ago

Hmmmm... could be some collision in texture id usage between your text rendering and libglvideo? Textures are managed in FrameTexture, and I would start by looking there and logging the texture ids libglvideo and your text rendering are using.

Movie holds a number of Frame::ref in m_gpuFrameBufer at /include/Movie.h#L219 . Each frame instance should hold a FrameTexture, allocated here /src/Movie.cpp#L244 . It could be that there's some leakage or improper grabbing of texture ids. Reading the code now, it looks like textures are allocated on the fly, but this doesn't really seem like the best approach. It might be better to allocate a texture pool somewhere and reuse textures. There could be a reason I've forgotten that I'm not doing this already, or it could be that I'm misreading the code and it is de-facto doing this.