Jump to content
  • Advertisement
Sign in to follow this  
BCash

OpenGL Strange display list problem.

This topic is 4327 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

Hey folks, long time lurker, first time poster. I'm still a bit new to opengl, and I'm hoping someone can give me some insight into a problem I'm having. I'm procedurally generating a series of triangular blocks to form a geosphere. Each block is an object containing its own display list. When I fire the app up, everything renders just fine. The problem creeps in when I call glPrint to display my menu. As soon as I do, it appears that the surface normals invert on every display list. I'm using NeHe's outline fonts verbatim, and I've narrowed it down to the glCallLists line in the code below:
GLvoid glPrint(const char *fmt, ...)					
{
	float		length=0;							
	char		text[256];							
	va_list		ap;								

	if (fmt == NULL)							
		return;								

	va_start(ap, fmt);								
	    vsprintf_s(text, fmt, ap);					
	va_end(ap);									

	for (unsigned int loop=0;loop<(strlen(text));loop++)	
	{
		length+=gmf[text[loop]].gmfCellIncX;	
	}

	glTranslatef(-length/2,0.0f,0.0f);				

	glPushAttrib(GL_LIST_BIT);							
	glListBase(base);							

	glCallLists(strlen(text), GL_UNSIGNED_BYTE, text);	//<-- Problem line
	glPopAttrib();								

	glTranslatef(-length/2.0f, 0.0f, 0.0f);
}

If I comment out the glCallLists line, the text doesn't appear (obviously) and the problem doesn't occur. It only crops up in display lists. My particles are generated on the fly, and they continue to display properly. Here's a shot of what happens: (Bottom one is with the problem showing, pardon the crappy free host) The problem is clearest on the surface of the sphere, where you can see that the blocks have inverted in the lower pic, with the surfaces facing inward. You'll also notice that the two HUD images in the upper left corners vanish, because they're now facing away from the camera. I'm assuming the glCallLists line is somehow changing a setting, but shouldn't pushing/popping the list bit attribute prevent the change from carrying onward? Thanks in advance for any input folks can offer.

Share this post


Link to post
Share on other sites
Advertisement
I'm using wglUseFontOutlines, and the post you linked was exactly what I was looking for. Just needed to fire a glFrontFace to correct the problem.

Thanks much for the quick reply!

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!