How to draw a circular gradient?

Hi there,

I’m stuck in a color trouble… I don’t know how to fill a circular shape with a radial gradient between black and white… Anybody out there can give help to a desperate OF beginner?

Many thanks

p.s: as attached file you can see an example of what I mean…

If you’re always drawing a circle, the fastest way to do this is to use an image (probably a PNG with alpha).

If you’re interested in using this kind of fill on arbitrary shapes, you’ll need a fragment shader. The fragment shader will use the screen space position, determine the distance from the center, and use that distance to lerp between two colors.