How to draw text with GLUT?

How to draw text with GLUT?

I reference a sample code as below website:
glutStrokeCharacter

But I cannot see any text on my screen. I put a part of my code as below. My window is create by SDL.
Please someone help me to solve this problem rendering a text in OpenGL!

void output(GLfloat x, GLfloat y, char *text)
{
	char *p;

	glPushMatrix();
	glTranslatef(x, y, 0);
	for (p = text; *p; p++)
		glutStrokeCharacter(GLUT_STROKE_ROMAN, *p);
	glPopMatrix();
}


		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		glEnable(GL_BLEND);
		glEnable(GL_LINE_SMOOTH);
		glLineWidth(2.0);

		glColor3f( 1.0f, 1.0f, 1.0f);
		output(0, 0, "This is antialiased.");
		glColor3f( 1.0f, 1.0f, 1.0f);

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.