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.
精彩评论