Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to draw a circle using simple vertices points and a big gl_PointSize value. I found this example and try to reproduce it on WebGL with no success.

share|improve this question

closed as not a real question by Nicol Bolas, msell, Anko, bummzack, Sean Middleditch May 29 '13 at 23:49

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

We need more information. What goes wrong? What did you try? – olevegard May 16 '13 at 9:17
Here is an example It seems my problem is my program doesn't compile when I add the varying variable. – moechofe May 16 '13 at 18:37
I forgot to add "precision mediump float;" in my fragment shader – moechofe May 16 '13 at 18:44
up vote 3 down vote accepted

This is just using regular old sine and cosine to step around the circumference of a circle and place points. You just need to know the center of the circle, the radius and how many points you want. The following pseudo code will output a set of points that make up the positions of dots you need to make a circle of points:

circleXY(Vector3f center, float radius, int dots) {
    float stepSize = ((2*Math.PI)/dots);
    for (float d = 0; d <= (2*Math.PI)-stepSize; d += stepSize) {
      addPoint(((sin(d) * radius) + center.x),
                (cos(d) * radius) + center.y));
    return result;

You will have to modify it to fit your language and APIs. But, if you know how to draw a point, you can easily utilize this to know where to draw them.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.