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 4331756
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:09:29+00:00 2026-05-21T10:09:29+00:00

I was hoping for some help on this as I’m really stuck after trying

  • 0

I was hoping for some help on this as I’m really stuck after trying to fix it for a few days.

Basically, my app has an OpenGL ES animation called levelsView that is displayed as soon as it has opened. Here is the code that starts my animation on the view controller:

- (void)animate
{
levelsView.animationInterval = 1.0 / 60.0;
[levelsView startAnimating];
[levelsView release];
}

The view controller also has a Switch button that lets the user change the animation. The code that displays the other animation is below:

    - (IBAction) Switch: (id) sender { 

    SnowFallViewController* vce = [[[SnowFallViewController alloc] initWithNibName:@"SnowFallViewController"
    bundle:nil] autorelease];
    [self presentModalViewController:vce animated:YES];
}

Also here is the view for the code that starts the second animation on the second view controller:

- (void)viewDidLoad {
[super viewDidLoad];

CGRect  rect = [[UIScreen mainScreen] bounds];

window = [[UIWindow alloc] initWithFrame:rect];

GLViewController *theController = [[GLViewController alloc] init];
self.controller = theController;
[theController release];

GLView *glView = [[GLView alloc] initWithFrame:rect];
[window addSubview:glView];

glView.controller = controller;

glView.animationInterval = 1.0 / kRenderingFrequency;
[glView startAnimation];
[glView release];

[window makeKeyAndVisible];

}

Basically, the problem I’m having is that I cannot get both the animations to work in the same application i.e. when the application is loaded up the first animation works but when the user clicks on the Switch button they only get a blank screen instead of the second animation.

One thing I’ve noticed is that the second animation will work if I do not start the first animation i.e. if I got in my animation code and delete
[levelsView startAnimating]; then the second animation will work(but obviously the first one will not).

Anyone with any insight on how I can fix this so I can get both animations to work?

Thanks,

Dave

  • 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-21T10:09:29+00:00Added an answer on May 21, 2026 at 10:09 am

    Assuming you’re using a CADisplayLink inside your GLView to run your animation loop, it seems from experience that they have mechanisms inside CADisplayLink to make sure that it doesn’t just keep issuing calls upon calls if you’re not keeping up with the refresh rate. It’s more than possible that logic confuses itself a little if you have multiple CADisplayLinks attached at once.

    I’d strongly suggest you add:

    - (void)viewDidAppear:(BOOL)animated
    {
        [glView startAnimation];
    }
    
    - (void)viewWillDisappear:(BOOL)animated
    {
        [glView stopAnimation];
    }
    

    Those tie into the built-in mechanisms surrounding presenting and dismissing a view controller — the view controller is being told in the first instance when its view did appear (ie, the transition in is finished) and in the second when its view is about to disappear (ie, just before the transition outward begins). By stopping and starting animation on your GL view based on whether your controller is visible you’ll save a lot of processing and prevent your disparate OpenGL views from fighting with each other for rendering times.

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

Sidebar

Related Questions

Hey guys, hoping for some help with this :( been stuck on it for
I'm hoping people have some ideas to help solve this problem. I am developing
I was hoping to get some help with my SQL Server script. Basically, I
I am hoping to get some help on this issue. Some users on IE
I'm hoping to get some help with this weird problem. We're running the Jacorb
Hoping for some help after reading into MVC routing and not coming up with
Hello all I was hoping to get some help with inported this class to
was hoping some-one could help me with this: My table is: id Version datetime
hoping to get some help with this query, I've worked at it for a
Hoping for some help I am using this script to ftp to one of

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.