glutTimerFunc problem

  
void collision(int v)
{
	collision_bug_one(0.0f, 10.0f);
	glutPostRedisplay();
	glutTimerFunc(1000, collision, 0);
}

void coll_sprite()
{
	if (board[0][0] == 1)
	{
		collision(0);
		flag[0][0] = 1;
	}
}

void erase_sprite()
{
	if (flag[0][0] == 1)
	{
		glColor3f(0.0f, 0.0f, 0.0f);
		glBegin(GL_POLYGON);
		glVertex3f(0.0f, 10.0f, 0.0f);
		glVertex3f(0.0f, 9.0f, 0.0f);
		glVertex3f(1.0f, 9.0f, 0.0f);
		glVertex3f(1.0f, 10.0f, 0.0f);
		glEnd();
	}
}

I am using glutTimerFunc to wait a small amount of time to display a collision sprite before I black out the sprite. unfortunately my code only blacks out the said sprite without drawing the collision sprite, I have done a great deal of research on the glutTimerFunc and animation.

well I have made some progress


void collision(int value)
{
	if (value >= 0)
	{
		if ((value % 2) == 0)
		{
			collision_bug_one(0.0f, 10.0f);
			glutPostRedisplay();
			glutTimerFunc(1000, collision, value--);
		}
		else
		{
			collision_bug_one(0.0f, 10.0f);
			glutPostRedisplay();
			glutTimerFunc(1000, collision, value--);
		}
		cout << value << endl;
	}
}

void coll_bug_one()
{
	float x = -0.5f + scroll;
	float y = -8.0f + up;
	float oWidth = 0.5f;
	float oHeight = 0.5f;

	float xTwo = 0.0f;
	float yTwo = 9.0f;
	float oTwoWidth = 0.5f;
	float oTwoHeight = 0.5f;

	if (checkCollide(x, y, oWidth, oHeight, xTwo, yTwo, oTwoWidth, oTwoHeight) == 1)
	{
		glutTimerFunc(1000, collision, 5);
		board[0][0] = 1;
	}
}

I just need a little help.

I finally solved my problem. you can close this thread.