开发者

OpenGL -- Drawing a circle by mapping a texture onto a square

I am currently using VBOs and triangle fans to draw circles. Someone 开发者_运维知识库told me that it was more efficient to map a texture of a circle onto a quad, and then apply transparency. My circle needs to gradually change color over time (hundreds of possible colors).

Is texturing a quad really more efficient? If so, could someone please provide me with a relevant link or some code/pseudocode (specifically how to change the colors for just the circular region, and the appropriate blending filter) as to how to make this dream a reality?


If your circle always has the same color over its whole region (colors don't change on different regions idependently), you can just change the color of your quad and multiply it by a white circle texture either using GL_MODULATE texture environment (if using fixed function) or by just writing the constant color instead of the texture color (if using shaders).


Along with mapping a white texture with texture coordinates and vertex coordinates, giving a valid color pointer with required color values in it worked for me. I did not use any GL_MODULATE in 1.x code.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜