Tuesday, April 16, 2013

[android help] Punch a hole into a texture in OpenGL ES 2.0 (Android)

Punch a hole into a texture in OpenGL ES 2.0 (Android) - Stack Overflow








Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

















I'm drawing a background texture to the screen, and then a foreground texture, now i wan't to punch a hole into the foreground texture where the user touches the screen. The result should be the foreground texture with a hole, and through the hole you see the background texture. How do i achieve this via OpenGL ES 2.0. I know i can do it with canvas and PorterDuff, but this method is too slow for me.


























Did you solve the problem? I'm in the same situation now. I tried to draw 3 kind of mesh in a view. One is a simple plane which is at the bottom. Second is also a simple plane which is at the middle layer. Last one is a circle primitive which is for punching a hole.


When I drew a circle, all plane was punched even though the bottom plane should be not punched. I just tried to test 2 ways. pseudo code. 1st way. circle.enableBlend(true); circle.blendFunc(GL_ZERO, GL_ZERO);


2nd way. circle.enableBlend(false);




















default







.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...