Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3494452
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:00:24+00:00 2026-05-18T12:00:24+00:00

I noticed that by default the sample app GLPaint comes with a recorded data

  • 0

I noticed that by default the sample app GLPaint comes with a recorded data in binary and it loads up on start, it is what is used to display the “Shake me” text.

I’m creating a similar painting app and I was just wondering what is the best way to actually record these strokes and load them up next time.

Currently I tried saving the location of every vertex using Core Data, then upon start it reads and renders all the points again, however I found this too slow.

Is there a better/more efficient method of doing this? Can the entire viewBuffer be saved as binary and then loaded back up?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:00:25+00:00Added an answer on May 18, 2026 at 12:00 pm

    If you look at the Recording.data you will notice that each line is its own array. To capture the ink and play it back you need to have an array of arrays. For purposes of this demo – declare a mutable array – writRay

        @synthesize writRay;
    //init in code
     writRay = [[NSMutableArray alloc]init];
    

    Capture the ink

    // Handles the continuation of a touch.
    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
    {  
    
     CGRect    bounds = [self bounds];
     UITouch*   touch = [[event touchesForView:self] anyObject];
    
     // Convert touch point from UIView referential to OpenGL one (upside-down flip)
     if (firstTouch) {
      firstTouch = NO;
      previousLocation = [touch previousLocationInView:self];
      previousLocation.y = bounds.size.height - previousLocation.y;
      /******************* create a new array for this stroke's points **************/
      [writRay addObject:[[NSMutableArray alloc]init]];
      /***** add 1st point *********/
      [[writRay objectAtIndex:[writRay count] -1]addObject:[NSValue valueWithCGPoint:previousLocation]];
     } else {
      location = [touch locationInView:self];
         location.y = bounds.size.height - location.y;
      previousLocation = [touch previousLocationInView:self];
      previousLocation.y = bounds.size.height - previousLocation.y;
      /********* add additional points *********/
      [[writRay objectAtIndex:[writRay count] -1]addObject:[NSValue valueWithCGPoint:previousLocation]];
     }
    
     // Render the stroke
     [self renderLineFromPoint:previousLocation toPoint:location];
    
    }
    

    Playback the ink.

    - (void)playRay{
    
     if(writRay != NULL){
    
      for(int l = 0; l < [writRay count]; l++){
        //replays my writRay -1 because of location point
       for(int p = 0; p < [[writRay objectAtIndex:l]count] -1; p ++){
        [self renderLineFromPoint:[[[writRay objectAtIndex:l]objectAtIndex:p]CGPointValue] toPoint:[[[writRay objectAtIndex:l]objectAtIndex:p + 1]CGPointValue]];
       }
      }
     }
    }
    

    For best effect shake the screen to clear and call playRay from changeBrushColor in the AppController.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with an MVC2 app that had migrated from an MVC1 app quite
Sample code: float** a; a = (float**) malloc(numNodes * sizeof(float*)); for(int i=0; i<`numNodes`; i++)
I have a button on an ascx control that calls a method on the
I am creating a script that will be run in a MS SQL server.
Table structure: +-------------+----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default |
I'm writing a simple service to set the default printer based on where I'm
I am absolutely totally news to Rails and to MongoDB. I have been following
I'm working on a project where a Windows web server running PHP is communicating
I've looked at the MySQL 5.1 docs, and still can't figured this out --

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.