开发者

Gradients for polygons in OpenGL

开发者 https://www.devze.com 2022-12-31 10:02 出处:网络
what 开发者_StackOverflow中文版is the best way to create a gradient for a 2D polygon in OpenGL, (Linear, and Radial)?

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

精彩评论

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