How to change point color from green to red when left clicked c++

Im trying to change point color from green to red when i left click the point
i have this code

        if (showRadar) {
            float translationX = 0.0f;
            float rotationZ = 0.0f;
            float rotationX = 269.8f;
            glPushMatrix();
            glTranslatef(translationX, 0, 0);
            glRotatef(rotationX, 1, 0, 0);
            glRotatef(rotationZ, 0, 0, 1);
            glPointSize(100);
            glBegin(GL_POINTS);
            for (const auto& point : points) {
                float lat = point.first;
                float lon = point.second;
                float lat_rad = lat * (3.14159265358979323846 / 180.0);
                float lon_rad = lon * (3.14159265358979323846 / 180.0);
                float R = 1.0 * 0.477;
                float x = R * cos(lat_rad) * cos(lon_rad);
                float y = R * cos(lat_rad) * sin(lon_rad);
                float z = R * sin(lat_rad);

                if (isClicked) {  
                    glColor3f(1.0f, 0.0f, 0.0f);
                }
                else {
                    glColor3f(0.0f, 1.0f, 0.0f);
                }
      

                glVertex3f(x, y, z);
            }
            glEnd();

            glDisable(GL_DEPTH_TEST);

            if (leftButtonPressed) {
                glColor3f(1.0, 0.0, 0.0);

            }        
            glEnable(GL_DEPTH_TEST);
            glPopMatrix();
        }

but when i left click the point nothing happens can someone help me with this issue please

if (leftButtonPressed) {
    glColor3f(1.0, 0.0, 0.0);

This happens after you’ve drawn everything. And this …

if (isClicked) {  
    glColor3f(1.0f, 0.0f, 0.0f);
} else {
    glColor3f(0.0f, 1.0f, 0.0f);
}

… uses a different variable to decide which color to use (isClicked vs leftButtonPressed).