Sign in to follow this  
Kustaz

Text Function Between 2D functions

Recommended Posts

When i put my text rendering code between my two functions which enable and disable 2D drawing, my text doesnt appear. here is the code for my text function:

void GLPrintString(unsigned int Font, char *str)
{
	if ((Font == 0) || (str == NULL))
	return;

	glPushAttrib(GL_LIST_BIT);
		glListBase(Base - 32);
		glCallLists(strlen(str), GL_UNSIGNED_BYTE, str);
	glPopAttrib();
}



And my 2D drawing functions:
void GLEnable2D(long ScreenResX, long ScreenRezY)
{
   int vPort[4];

   glGetIntegerv(GL_VIEWPORT, vPort);

   glMatrixMode(GL_PROJECTION);
   glPushMatrix();
   glLoadIdentity();

   glOrtho(0, ScreenResX, ScreenRezY, 0, -10, 10); 
   glMatrixMode(GL_MODELVIEW);
   glPushMatrix();
   glLoadIdentity();
}

void GLDisable2D()
{
   glMatrixMode(GL_PROJECTION);
   glPopMatrix();
   glMatrixMode(GL_MODELVIEW);
   glPopMatrix();
}


Any help would be REALY appreciated, the sooner i get this working, the sooner i can start major work on my game =D.

Share this post


Link to post
Share on other sites
Are you setting the position of the text.


GLEnable2D(400, 400);
glRasterPos2f(50, 50);
GLPrintString(...);
GLDisable2D();



Also check if it works using gluOrtho2D(...). Because I am not sure of your glOrtho call.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this