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

  • Home
  • SEARCH
  • 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 195217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:39:43+00:00 2026-05-11T16:39:43+00:00

I’m using OpenGL ES to make a game on the iPhone. Unfortunately, I see

  • 0

I’m using OpenGL ES to make a game on the iPhone. Unfortunately, I see small (and irregular) hiccups.

I use a timer with a sleep, calling the draw function every 60th of a second, in order to garantee a solid frame rate. I’ve tried to change the moment in time my timer awakens from its sleep, giving the draw function more time to execute. The hiccups do get less once the draw function’s been given more time. With 8 milliseconds, the animations are almost fluid. My findings are:

  1. Apparently giving the GPU more time to execute the actual drawing, results in an (almost) perfect fluid animation.
  2. Drawing at the exact end of my frame results in stutter, hiccups and what not.

Now that I know that, I’m not sure how to proceed. I have two contradicting ideas about the cause of this behaviour:

  1. First, could it be that the OpenGL commands interfere with the drawing of the previous frame? As far as I understand this can’t be the case since the commands are stored and will only execute when the draw command is given.
  2. Second, could the fluctuating time of the draw commands cause the timer to skip a tick?

So which explanation is more likely? Or is neither? Of course I could just try to put the draw function in a seperate thread and see if that solves my problem. But I hope to understand more of OpenGL.

This is the function being called and explains what I’m taking about:

- (void) drawView
{
    // measure time with mach_absolute_time

    // gameEngine update    
    // OpenGL commands (translate, rotate, drawArrays etc.) 

    // end measure time with mach_absolute_time
    // usleep(animationInterval - duration  - constant) 
    // constant is the time to start executing

    // draw
    glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
    [context presentRenderbuffer:GL_RENDERBUFFER_OES];    
}
  • 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-11T16:39:44+00:00Added an answer on May 11, 2026 at 4:39 pm

    You might want to read this article about game loops, which explains a lot. Generally the best solution is to call the draw routine in an infinite loop inside a separate thread (see this question) and update the underlying game model according to how much time elapsed since the last update. This will give you smooth motion.

    Edit: As for the source of the “hiccups”, they probably have nothing to do with OpenGL. At 60 fps we are talking 1/60 sec ≈ 17 ms per frame. This is a tight schedule that’s easy to miss, because there are other processes running on the device. Safari or Mail.app wake up in the background, the device thinks for a while and now your frame takes 30 ms or even much more. This is very easy to spot if your model expects perfectly steady framerate. The solution is to update the model according to the real time elapsed, as I have written above. The linked article explains this all thoroughly.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I want use html5's new tag to play a wav file (currently only supported
We're building an app, our first using Rails 3, and we're having to build

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.