I would like to for example draw shapes A, B, C then set the ble开发者_如何学Pythonnder, then draw shape D and everywhere where shape D is, the scene shows my background color of (1,1,1,0). Thanks
I'm not aware of that being possible directly. There are a few possibilities to get the same effect though. The cleanest would probably be to start by filling the stencil buffer with 1's, then drawing shape D into the stencil buffer with 0's, then draw everything else (with the stencil buffer enabled, of course).
Much simpler than other answers :
- Display shapes A, B and C the normal way
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_ALPHA_TEST);
- glDisable(GL_BLEND);
- Display shape D with color (1,1,1,0)
and you're done.
glBlendEquation can do it.
精彩评论