Reputation: 31
So I'm using the GLPaint sample from the Apple dev docs and I'm curious as to how I could implement zooming the view to a point based on a single/double tap. I don't need the touch handling part, as I am familiar with that. It's more the actual zooming that I can't wrap my head around. I'm a noob when it comes to OpenGL so I definitely could use some OpenGL guru's help on this one!
Upvotes: 0
Views: 344
Reputation: 162164
In the terms of GLPaint: You can't, sorry, at least not without substantially changing GLPaint.
OpenGL is a drawing API and if you change something, you must redraw the whole thing. GLPaint is a ridiculous bad tutorial as it accumulates the drawing operations on the view framebuffer. Zooming however requires a full redraw, which will loose the contents of the view framebuffer, thus the drawing. One could fix this, by drawing to an intermediate framebuffer object, used as texture on a quad that's zoomed.
Or build a list of strokes that's rerendered everytime the zoom changes.
Upvotes: 1