farm ostrich
farm ostrich

Reputation: 5959

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?

Upvotes: 0

Views: 1392

Answers (2)

Ramya Maithreyi
Ramya Maithreyi

Reputation: 507

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.

Upvotes: 1

Christian Rau
Christian Rau

Reputation: 45948

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).

Upvotes: 2

Related Questions