// Clear the draw and depth buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Take the contents of the current accumulation buffer and copy it to the colour buffer with each pixel multiplied by a factor
// i.e. we clear the screen, draw the last frame again (which we saved in the accumulation buffer), then draw our stuff at its new location on top of that
// Clear the accumulation buffer (don't worry, we re-grab the screen into the accumulation buffer after drawing our current frame!)
// Translate everything into the screen (z-axis) by -windowDepth
glTranslatef(0.0f, 0.0f, -windowDepth);
// Apply oscillating rotation to the matrix around the Z-axis.
// Multiplying by 100 is just a fudge factor to increase the total rotation amount
glRotatef(cos(deg2rad(Star::rotationAmount)) * 100, 0.0f, 0.0f, 1.0f);
vector<star>::iterator starIter; // This needs to be a standard iterator not a constant iterator so we can modify what's being pointed to!!
// Do the actual drawing...
for (starIter = stars.begin(); starIter != stars.end(); starIter++)
// Change the point size to the stars size property
glBegin(GL_POINTS); // This needs to be inside the loop so the PointSize change (above) takes effect
// Set the colour
glColor3f(starIter->getRedComponent(), starIter->getGreenComponent(), starIter->getBlueComponent());
// Draw the point
glVertex3f(starIter->getX(), starIter->getY(), starIter->getZ());
// Move the star closer (or reset it if it's too close) ready for the next frame
// Swap the buffers so we can see what we've drawn without -watching- it being drawn