开发者

Gradients for polygons in OpenGL

what 开发者_StackOverflow中文版is the best way to create a gradient for a 2D polygon in OpenGL, (Linear, and Radial)?

Thanks

How can you generate textures for radial gradients on the fly?


Linear is very easy - you just set different colors to different points like

red ---- red
|        |
|        |
|        |
blue ---- blue

for radial texture might be better option

to generate it on fly create empty texture then fill it with function sqrt((MAXX - x)^2 + (MAXY - y)^2), then add color to it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜