user983447
user983447

Reputation: 1737

what can happen if I overflow OpenGL matrix stack?

I wonder what what can happen if I overflow OpenGL matrix stack - I mean, I push too many times without popping. I just tried and on my machine no visible error happened. Is it normal? Is it like that on each correct OpenGL implementation? Or could OpenGL report some error, or something could explode?

Upvotes: 1

Views: 146

Answers (1)

jweyrich
jweyrich

Reputation: 32260

It must set an error that can be retrieved with glGetError​. According to OpenGL Error Codes:

GL_STACK_OVERFLOW​, 0x0503: Given when a stack pushing operation cannot be done because it would overflow the limit of that stack's size.

You can check its limit with:

GLint depth;
glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth);

I assumed the model view stack, but you can check other stacks as well.

Upvotes: 4

Related Questions