Siarhei Fedartsou
Siarhei Fedartsou

Reputation: 1873

OpenGL ES 1.1 clearColor drawing

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

Upvotes: 0

Views: 510

Answers (1)

Matic Oblak
Matic Oblak

Reputation: 16794

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)

Upvotes: 2

Related Questions