Adding one more object causes others to disappear.

Hi all!

For my game that is just about finished I have a 3D font score board that I wish to render with the environment. I have noticed that when I render this scoreboard it causes other objects to disappear on screen and slightly corrupts the rendering of certain other objects.

Could this be because I’m simply using too many glPushMatrix()'s and glPopMatrix()'s? I will be writing some test code later, but to help speed up the process, I was wondering if anyone had any other ideas for the cause.

Cheers.

Visual C++ .NET 2003
OpenGL 1.1
Windows XP Pro.

That´s not much information you are giving us.

Anyway, using too many glPush´s and glPop´s can be a problem, because their is a limit on the stack-size. For the modelview-matrix it´s limited to 32 entries on most cards, i think. Could be more though.

Jan.

Cheers Jan.

It’s like when the scoreboard is rendered some objects appear inside one another and others are simply hollow, then on top of that, other completely disappear! It’s very frustrating.

If I can get some screenshots up, I’ll post them.

If you suspect push-pop-matrix issues, query the max stack sizes for the matrices you use.
Especially the projection stack is very small normally, minimum number of entries which must be supported is 2.
You should get GL_STACK_OVERFLOW and/or GL_STACK_UNDERFLOW errors from glGetError() if you exceeded stack limits.

Thanks for that, Relic. Just what I need to do. I’m off to check.

No joy. Looks like I’ll have to play with the enabled features.

I’ve cracked it! I wasn’t saving my attributes

glPushAttrib(GL_ALL_ATTRIB_BITS);
// Do OpenGL stuff
glPopAttrib();

Thanks all for your help!

32 on most cards? Oh no, just about every card I have programmed on is lowballing the OpenGL minimums… 16 modelview matricies in the stack. I have both nVidia and ATI cards.

[This message has been edited by 147-2 (edited 02-22-2004).]