Jump to content
  • Advertisement
Sign in to follow this  
Kustaz

Text Function Between 2D functions

This topic is 4880 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!