Here is the main parts of the code. It only draws the green and yellow discs I am using MSYS2 under Win 10 and trying to draw a bull’seye with 5 discs
void drawDisc(float R, float X, float Y, float Z, float red, float green, float blue,int ord)
{
float t;
int i;
vertices[(ord-1)*(N+2)*3]=X;
vertices[(ord-1)*(N+2)*3+1]=Y;
vertices[(ord-1)*(N+2)*3+2]=Z;
colors[(ord-1)*(N+2)*3]=red;
colors[(ord-1)*(N+2)*3+1]=green;
colors[(ord-1)*(N+2)*3+2]=blue;
for (i = 0; i <= N; ++i)
{
t = 2.0 * PI * i / N;
vertices[(ord-1)*(N+2)*3+3*(i+1)]=X+cos(t)*R;
vertices[(ord-1)*(N+2)*3+3*(i+1)+1]=Y+sin(t)*R;
vertices[(ord-1)*(N+2)*3+3*(i+1)+2]=Z;
colors[(ord-1)*(N+2)*3+3*(i+1)]=red;
colors[(ord-1)*(N+2)*3+3*(i+1)+1]=green;
colors[(ord-1)*(N+2)*3+3*(i+1)+2]=blue;
}
first[ord-1]=(ord-1)*(N+2)*3;
countVertices[ord-1]=(N+2);
}
It gets called as:
drawDisc(40.0, 50.0, 50.0, 0.0, 0.0, 1.0, 0.0, 1);
drawDisc(32.0, 50.0, 50.0, 0.2, 1.0, 0.0, 0.0, 2);
drawDisc(24.0, 50.0, 50.0, 0.4, 0.0, 0.0, 1.0, 3);
drawDisc(16.0, 50.0, 50.0, 0.6, 1.0, 1.0, 0.0, 4);
drawDisc(8.0, 50.0, 50.0, 0.8, 1.0, 0.0, 1.0, 5);
glMultiDrawArrays(GL_TRIANGLE_FAN, &first[0], &countVertices[0], 5);
glFlush();
I spent hours debugging and printing out every possible value I can think of, but to no avail. Any hint to what might be the issue is appreciated…