Reputation: 41
I am digging into the sample project created by Apple: https://developer.apple.com/library/ios/samplecode/GLPaint/Introduction/Intro.html
It demonstrates how to use OpenGL in Objective-C.
When I start the app a "SHAKE ME" graph is drawn stroke by stroke, with animation. As I want to modify this project to make my own app, in PaintingView.m
, I want to know how to disable the animation whenever I call the
renderLineFromPoint:toPoint:
method (specifically, in the playback:
function, because in touchesMoved:withEvent:
the animation is unnoticeable).
That is, I want to write a renderLineFromPoint:toPoint:animated:
method such that, if I put NO
after animated:
, the line would be drawn instantly.
Upvotes: 1
Views: 207
Reputation: 41
Found it.
All I have to do is, in
- (void)renderLineFromPoint:(CGPoint)start toPoint:(CGPoint)end
silence the two lines at the end:
// Display the buffer
// glBindRenderbuffer(GL_RENDERBUFFER, viewRenderbuffer);
// [context presentRenderbuffer:GL_RENDERBUFFER];
And after the whole graph are drawn onto the buffer, call this two lines to display the whole graph; it will appear instantly.
Upvotes: 1