PDA

View Full Version : Adding one more object causes others to disappear.



Mathematix
02-17-2004, 12:28 AM
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.

Jan
02-17-2004, 12:34 AM
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.

Mathematix
02-17-2004, 12:48 AM
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.

Relic
02-17-2004, 06:08 AM
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.

Mathematix
02-17-2004, 11:15 AM
Thanks for that, Relic. Just what I need to do. I'm off to check. http://www.opengl.org/discussion_boards/ubb/smile.gif

Mathematix
02-18-2004, 05:38 AM
No joy. Looks like I'll have to play with the enabled features.

Mathematix
02-18-2004, 04:03 PM
I've cracked it! I wasn't saving my attributes

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

Thanks all for your help!

147-2
02-22-2004, 09:01 AM
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).]