Immediate graphics in Quartz? - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Immediate graphics in Quartz? (/thread-8418.html)
Immediate graphics in Quartz? - Sparklight - Dec 13, 2010 07:02 PM
Quartz graphics are obviously designed in a "batch" model: the system calls you with an event when it's time to redraw, you respond with the drawing commands to do so, and then, upon return, all those graphics actually make it to the screen. I would like to know if it's possible to break out of this model.
1. I would rather issue graphics commands directly in response to a touchesBegan event, even if I have to go through a little extra set up to do so.
2. Some things are appearing that I think should not, and some things are not appearing that I think should. I would really like it, for debugging purposes, if I could single step through my drawing code and see the changes visually, right now. Even if I had to put in an extra "flush graphics" command between other graphics commands, to make it happen, it would be worth it.
Are these things possible? If so, how? Pointers to appropriate sections of online references, as well as direct answers, would be very helpful.
RE: Immediate graphics in Quartz? - SethWillits - Dec 14, 2010 12:48 PM
There is no way to break out of it. The only way drawing ever happens is in response to the drawing event. You can force that even to be called immediately, but it's still just calling that same event.
I think instead of trying to rewrite your code in some odd hacky way to debug it (where you'd probably introduce more problems than you'd discover), you should just debug it in place, written the correct way.
How will the normal tricks of the trade not work here?
RE: Immediate graphics in Quartz? - Sparklight - Dec 14, 2010 02:31 PM
Forgive me, I'm new to the iOS programming world, and I'm not sure what tricks of the trade you have in mind. Honestly, I'm used to single stepping through graphics code and seeing the results. Please fill me in.
> You can force that event to be called immediately, but it's still just calling that same event.
Do you mean that I could force that event to be called in the middle of processing some other event? Or do you mean just after processing the other event?
RE: Immediate graphics in Quartz? - SethWillits - Dec 14, 2010 03:12 PM
Drawing is buffered. You can't step through drawing code in the debugger and immediately see the result on the screen because it's not drawing directly to the screen.
The typical ways of debugging drawing code is to simply comment out code to figure out what the result is of each section/line. You can create an image out of the current context to save to a file at different points through the drawing.
(Dec 14, 2010 02:31 PM)Sparklight Wrote: Do you mean that I could force that event to be called in the middle of processing some other event? Or do you mean just after processing the other event?
Actually nevermind. On iOS you can't force an immediate update like you can on Mac OS X.