I have an OpenGL problem to solve. I have an object/mesh A, an object/mesh B and a background texture C.
Initially the framebuffer is filled with background texture C. We draw both A & B in the framebuffer. We want to keep object A visible, and object B always invisible.
In the beginning, A is in front of B. During rotation, at a certain angle, B is in front of A based on the depth test result, but since B is always invisible, B's part should be filled with background C.
Does anyone know a simple approach to solve this issue?
Is stencil test a good approach? Basically set object B with a color, compare the color of B with background C, and show the background C when the test fail.
Does anyone have any sample code I can read?