简体   繁体   中英

OpenGL ES 1.1 clearColor drawing

How can I draw with [UIColor clearColor] in OpenGL ES 1.1? I want to create eraser tool...

You can create a masked image. There are many ways to do this and here is what worked for me:

I created an image that has a black circle and all the rest is transparent. I create a texture from this image and draw it as a simple textured square but using this blend func:

glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);

Do not forget to enable blend and after the draw call is done restore your blend func (or disable the blend if you don't use it anywhere else)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM