We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
stack depth inspector (Read 936 times)
stack depth inspector
Oct 29th, 2007, 7:43pm
 
Very low priority suggestion, fwiw:
It might be handy to have a way to query the current matrix stack depth.  (or alternatively, to query amount of stack space remaining)  So you could tell in advance if pushMatrix() is going to fail.  Would be nice for recursive things where depth isn't known in advance - could be used to break out of recursion when limit reached.  

[edited] oops, forgot to say why:  point would be to avoid having to catch exceptions -- i don't mind try/catch myself, but seems "alien" to the p5 api[/edit]
Re: stack depth inspector
Reply #1 - Oct 29th, 2007, 8:55pm
 
You could keep track of the current dept yourself, and check that against g.MATRIX_STACK_DEPTH which should be the maximum (currently 32)
Re: stack depth inspector
Reply #2 - Oct 29th, 2007, 10:08pm
 
Understood.  But that approach just helps make the point:  users wouldn't have to reinvent a stack pointer that already exists if an accessor method were available.

It's a trivial issue, and try/catch does work just fine -- the only reason I brought it up is because it seemed out-of-step with most of the api design philosophy that otherwise tends (or so it seems, at least apparently) to avoid exposing the user to exception handling.
Re: stack depth inspector
Reply #3 - Oct 30th, 2007, 2:46pm
 
i think the original stack depth on opengl was 16. if you hit the limit of 32 on the /matrix/ stack depth (not the stack depth of functions in your code), you're probably doing something wrong. Wink
Page Index Toggle Pages: 1