yamishinigami
yamishinigami

Reputation: 49

connecting outline rendering in open gl es

I'm trying to create my first 2d game for the android platform using Java and Open GL es. Now my problem is that my game needs a water element and I decided to do it so that the water is made up of little circles with an outline so that they look like cartoony drops of water but when two or more of these little drops get next to each other(and intersect a little) I want to have their outlines connect thus forming a bigger drop. So my question is, is this possible(the dynamically connecting outlines) and if it is could anyone tell me how to do it or link me to a tutorial or something?

Here's a little drawing I made in paint to illustrate what I'd like to achieve:

enter image description here

Upvotes: 3

Views: 105

Answers (1)

ravuya
ravuya

Reputation: 8766

You might be able to do this with the stencil buffer, assuming your device supports it.

The inner part of the circles would write into the stencil buffer. The outer part of the circles would only write where the stencil buffer is zero.

You could probably do it the same way (or similarly) with a shader and a colour buffer/FBO as well.

Upvotes: 2

Related Questions