Image not rotating?

This code is suppose to create a spiral of points in a 3d space and the user should be able to rotate the spiral. I’m pretty sure the problem is with xRot and yRot but the book(OpenGl Super bible 4th edition) doesnt even declare these variables! Here is the code:


#include <cmath>
#include <glut.h>

// define a constant for the value of PI
#define GL_PI 3.1415f

////////////////////////////////////////////////////////////////////
// Globals

////////////////////////////////////////////////////////////////////
// Set up the rendering state
void SetupRC(void)
{
	// black background
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

	// set drawing color to green
	glColor3f(0.0f, 1.0f, 0.0f);
}

///////////////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
{
	GLfloat x, y, z,angle, yRot = 0, xRot = 0; // Storgae for coordinates and angles

	// Clear the window with current clearing color
	glClear(GL_COLOR_BUFFER_BIT);

	// Save matrix state and do the rotation
	glPushMatrix();
	glRotatef(xRot, 1.0f, 0.0f, 0.0f);
	glRotatef(yRot, 0.0f, 1.0f, 0.0f);

	// Call only once for all remaining points
	glBegin(GL_POINTS);
		z = -50.0f;
		for(angle = 0.0f; angle <= (2.0f * GL_PI) * 3.0f; angle += 0.1f)
		{
			x = 50.0f * sin(angle);
			y = 50.0f * cos(angle);

			// Specify the point and move the Z value up a little
			glVertex3f(x, y, z);
			z += 0.5f;
		}

	// Done drawing points
	glEnd();

	// Restore transformations
	glPopMatrix();

	// Flush drawing commands
	glutSwapBuffers();
}


//////////////////////////////////////////////////////////////////
// Called by GLUT when the window has changed size
void ChangeSize(GLsizei w, GLsizei h)
{
	GLfloat nRange = 100.0f;

	// Prevent a dive by zero
	if(h == 0)
		h = 1;

	// Set viewport to window dimensions
	glViewport(0,0,w,h);

	// Reset projection matrix stack
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();

	// Establish clipping volume
	if(w <= h)
		glOrtho(-nRange, nRange, -nRange*h/w, nRange*h/w, -nRange,
				  nRange);
	else
		glOrtho(-nRange*h/w, nRange*h/w, -nRange,
				  nRange, -nRange, nRange);

	// Reset model view matrix stack
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}

//////////////////////////////////////////////////////////////////
// Main program entry point
	int main(int argc, char* argv[])
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowSize(800, 600);
	glutCreateWindow("twisty");
	glutDisplayFunc(RenderScene);
	glutReshapeFunc(ChangeSize);

	SetupRC();
	glutMainLoop();

	return 0;
}

yRot = 0, xRot = 0 are declared as local variable inside function RenderScene().
If you want user control, you may need to make these global variables and should update these variable onEvent(key).

First of all, thanks for putting your code inside of [ code] and [\ code] tags. What happens when you run this code? Do you see anything - perhaps a static spiral?