Immediate graphics in Quartz?

Nibbie
Posts: 2
Joined: 2010.12
Post: #1
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.

Ken
Quote this message in a reply
⌘-R in Chief
Posts: 1,256
Joined: 2002.05
Post: #2
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?
Quote this message in a reply
Nibbie
Posts: 2
Joined: 2010.12
Post: #3
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?
Quote this message in a reply
⌘-R in Chief
Posts: 1,256
Joined: 2002.05
Post: #4
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  converting quartz to openGL ES aerospaceman 2 3,853 Apr 12, 2010 10:57 AM
Last Post: ThemsAllTook
  Quartz Composer macnib 3 4,087 Sep 7, 2009 10:33 AM
Last Post: maximile
  OpenGL vs Quartz Performance for 2D Game lfalin 1 3,734 Apr 25, 2007 09:51 PM
Last Post: OneSadCookie
  Quartz Composer Skorche 8 5,678 Jun 23, 2005 08:17 PM
Last Post: Jesse Abram
  Quartz extreme fun Sohta 3 3,501 Dec 2, 2003 06:06 AM
Last Post: Sohta