Text doesn't get drawn on screen

Hi, I have this function which draws each number around the clock, but somehow it only draws “12” and not the rest. Is there anything wrong with my code?

this is the drawing function:

void drawText(const char * message,float x,float y)
{       /* Written by John McCormack
	/* raster pos sets the current raster position
	 * mapped via the modelview and projection matrices
	 */
	glRasterPos2f(x, y);
	
        
	/*
	 * write using bitmap and stroke chars
	 */
	
	while (*message) {
		glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, *message);
		glutStrokeCharacter(GLUT_STROKE_ROMAN,*message++);
	}
}

this is the drawing number function:

void draw_number(void)
{
  int i;
  glLoadIdentity();
  for(i=0;i<=12;i++)
  {
     if(i==0){ drawText("12",-0.09,0.78);}
     if(i==1){ glRotatef(30,0,0,-1);drawText("1",-0.09,0.78);}
     if(i==2){ glRotatef(30,0,0,-1);drawText("2",-0.09,0.78);}
     if(i==3){glRotatef(30,0,0,-1); drawText("3",-0.09,0.78);}
     if(i==4){ glRotatef(30,0,0,-1);drawText("4",-0.09,0.78);}
     if(i==5){ glRotatef(30,0,0,-1);drawText("5",-0.09,0.78);}
     if(i==6){glRotatef(30,0,0,-1); drawText("6",-0.09,0.78);}
     if(i==7){ glRotatef(30,0,0,-1);drawText("7",-0.09,0.78);}
     if(i==8){ glRotatef(30,0,0,-1);drawText("8",-0.09,0.78);}
     if(i==9){glRotatef(30,0,0,-1); drawText("9",-0.09,0.78);}
     if(i==10){ glRotatef(30,0,0,-1);drawText("10",-0.09,0.78);}
     if(i==11){ glRotatef(30,0,0,-1);drawText("11",-0.09,0.78);}
   }
  }     

Make sure you dont call your draw_number() function between a glBegin() - glEnd() block because calling glRotatef() inside such a block will cause a GL_INVALID_OPERATION error.

General hint: if something isnt drawn correctly or works the way you want, check the return values and (like in this case) use glGetError() to check if something failed.

Because glRotate does not effect the raster position for the bitmap text. So ether you need to use something like stroke charactor or figure the rotation of you text and then plug in the x/y coordinates.

I not sure why you are using -1 and not 1 on selecting to rotate the Z axis?

But this is a simpler code for the numbers:

void draw_number(void)
{
int i;
char text[30];
glLoadIdentity();
for(i=0;i<=12;i++)
{
glPushMatrix();
glRotatef(30 * i, 0,0,1)
itoa(i,text,10); // converts a interger to a ascii number
drawText(text,-0.9,0.78);
glPopMatrix();
}

Try these changes in the text drawing routine, also may need to scale the charactors.

void drawText(const char * message,float x,float y)
{       /* Written by John McCormack
	/* raster pos sets the current raster position
	 * mapped via the modelview and projection matrices
	 */
	//glRasterPos2f(x, y);
	
        
	/*
	 * write using bitmap and stroke chars
	 */
	
	while (*message) {
				glutStrokeCharacter(GLUT_STROKE_ROMAN,*message++);
	}
}