# Rendering and rotation question

I have series of circles , based on points primitive.
Two set , one “stationary” and one rotated.
The first circle is centered on NDC coordinates 1,0 with diameter of 1.
Each subsequent circle is half size of previous - half coordinates and half diameter.
The objective is to rotate ALL of these AROUND z axis
Here is the code

``````		glRotatef(-90, 0.f, 0.f, 1.f); // rotate to -img around z axis
glTranslatef(-1.0, 0.0, 0.0); //test shift
for (scale = 0; scale != MAX_SCALE; scale++) {
{ // single scale
OpenGL_Draw_10_Circles(1, // point size
3, // selection highlight
0, // apply to circle
0, // future option
0, //  green,
0 //float blue )
);
glFlush();
}
// next scale
glScalef(.5, .5, .5);
// move center
glTranslatef(1,0,0);
}
``````

The problem is
The rendered (whatever you want to call it ) "rotation point’ is LAST circuit center, not x-0 , y =0, z = 1 point as coded.
Any suggestion WHERE is the error ?

Just FYI.
Here is a latest, working , modification to the code.
After corrective translation , It builds three test sets …, one on x axis and two 90 degrees rotated around test point 0,0.

It definitely rotates around center of last primitive (circle)
Sure like to know why,

There is small math work to add to make it more universal.
NOT an OpenGL problem. MY problem.

``````		for (int rotation = 0; rotation != 270; rotation += 90) {
glRotatef(rotation, 0.f, 0.f, 1.0); // rotate to img
glPushMatrix();
OpenGL_NDC_coordinates(1);
glFlush();
glPopMatrix();
for (scale = 0; scale != MAX_SCALE; scale++) {
{ // single scale
//printf("\n scale  %i ", scale);
OpenGL_Draw_10_Circles(1, // point size
3, // selection highlight
0, // apply to circle
0, // future option
0, //  green,
0 //float blue )
);
glFlush();
}
//printf("\n next scale "); // next scale
glScalef(.5, .5, 0);
//printf("\n next translate"); // next scale
// translate
glTranslatef(1, 0, 0);
// next scale
}

// reset scale
glScalef(16, 16, 16);      // restore scale
glPushMatrix();
OpenGL_NDC_coordinates(1);
glFlush();
glPopMatrix();

// correct wrong rotataion point - works only with MAX_STATE == 4
float test_offset = (float) 1/ (float)  pow (2.0, MAX_SCALE);
if( rotation == 0 )
{
glTranslatef(test_offset, -1, 0);        // mpves to x axis TOK
}
else
{
glTranslatef(1 + test_offset, 0, 0);        // mpves to x axis TOK

}
}``````

you areusing OpenGl 2.0? seems like that.
Edit: you should use 3.0 or adove.