sourcecode for a box (NewB)

I have a little sourcecode to create a box:

void Box(GLfloat scale) {
glBegin(GL_QUADS);

	glVertex3f (-scale, scale,-scale);
	glVertex3f ( scale, scale,-scale);
	glVertex3f ( scale,-scale,-scale);
	glVertex3f (-scale,-scale,-scale);
	
	glVertex3f (-scale, scale, scale);
	glVertex3f ( scale, scale, scale);
	glVertex3f ( scale,-scale, scale);
	glVertex3f (-scale,-scale, scale);
	
	glVertex3f (-scale, scale,-scale);
	glVertex3f (-scale, scale, scale);	
	glVertex3f (-scale,-scale, scale);
	glVertex3f (-scale,-scale,-scale);
	
	glVertex3f ( scale, scale,-scale);
	glVertex3f ( scale, scale, scale);
	glVertex3f ( scale,-scale, scale);
	glVertex3f ( scale,-scale,-scale);
	
	glVertex3f (-scale,-scale,-scale);
	glVertex3f (-scale,-scale, scale);
	glVertex3f ( scale,-scale, scale);
	glVertex3f ( scale,-scale,-scale);
	
	glVertex3f (-scale, scale,-scale);
	glVertex3f (-scale, scale, scale);
	glVertex3f ( scale, scale, scale);
	glVertex3f ( scale, scale,-scale);
glEnd();

}

but when i want to start it with
putPurple(0.4);
my Programm crashes, can someone help me?

try to draw a single triangle, quad, maybe you havent initialized opengl correctly ( wrong defined vertices etc. only produce opengl intern errors )

What does putPurple(0.4) do? And why do I feel as if this is a joke?

j

sorry, I wrote purpleBox. Because first i wanted to create more colors, and it was an other procedure. (is it the correct english word???)

It must be box(0.4).
I have initialized opengl correctly, becase i can render other thing without any problems.

(sorry for my bad English)

it seems that the code is ok, so search for other errorsurces, maybe you call this function after a glBegin(…), remove glBegin(…) and glEnd() in this function, if it works you have called glBegin before this functioncall and this causes the crash, or you call this function from a thread, which isn’t the one with the renderingcontext …