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.
IndexProgramming Questions & HelpPrograms › drawing order
Page Index Toggle Pages: 1
drawing order (Read 1548 times)
drawing order
Mar 22nd, 2010, 6:06am
 
Hi

I'm trying to draw multiple shapes and some are being hidden due to the drawing order.

Does anyone know of a link to a document or function that can force a shape be draw at the back or front?

Thanks

Graham
Re: drawing order
Reply #1 - Mar 22nd, 2010, 6:19am
 
why dont you just draw them at last ?if its the last shape drawn there is now way that it will be hidden.

anyway maybe you wanna checkout this processing layer library http://processing.org/discourse/yabb2/?num=1259116487
Re: drawing order
Reply #2 - Mar 22nd, 2010, 8:53am
 
Hi

Thanks for your reply.

I have an unsorted collection of objects and at the time of drawing I am unsure as to what is being hidden but want to see all objects. Thus, I can't prescribe an order explicitly by "the last one".

Rather, I want to set an object with a specific ID to the back.

Thanks for the link - I'll checkout the layering API.
Re: drawing order
Reply #3 - Mar 22nd, 2010, 1:20pm
 
Quote:
Rather, I want to set an object with a specific ID to the back.


Like Cedric said, since you know the ID of the object just draw it last. Or first, if you want it constrained to the back.
Re: drawing order
Reply #4 - Mar 23rd, 2010, 1:46am
 
You have a collection of objects.
You can re-order this collection, or a copy of this collection, by sort order, which you can store as field of your objects.
Then you draw the objects in the order of the sorted list.
Or if you want to move a specific object, just remove it from the collection and insert it back at the position you want.
Re: drawing order
Reply #5 - Mar 23rd, 2010, 11:57pm
 
Maybe not exactly your solution but helpful for debugging: You might consider drawing with an alpha (transparency) value <255 i.e. color(255,0,0,100) for transparent red. This way you can easily see which object "hides" the other.
Otherwise the suggestions above are the way to go.
Page Index Toggle Pages: 1