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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:47:23+00:00 2026-06-13T04:47:23+00:00

I have the code below (a bare-bones version of Nehe tutorial 1 ported to

  • 0

I have the code below (a bare-bones version of Nehe tutorial 1 ported to JOGL 2.0) that is requesting an FPSAnimator that animates 30 FPS. When I run the code, it prints 21.321962 or 21.413277 FPS. When creating the FPSAnimator, as you can see, I specify 30 frames per second is desired. This is on a modern machine with a Core i7 CPU, 24GB of RAM, and an ATI Radeon HD 5700 Series graphics card. 21.3 FPS does not appear to be a limit either. When I raise or lower the requested FPS, the reported FPS does go up and down (though it doesn’t appear to be a linear relationship).

However, sometimes when I run the code on the same machine is gives me 30.30303 FPS. In both cases I have nothing but a few web browser tabs and eclipse open on the machine. It is also worth noting that this doesn’t only happen in this simple example, it happens in all of my JOGL based applications. I have merely provided this simple example to demonstrate the issue.

I’ve seen this issue on a few machines. Maybe it’s just my imagination, but it doesn’t seem to occur on machines with NVidia GeForce cards, but I have seen it happen on machine’s with ATI cards and NVidia Quadro FX cards.

What could be causing this difference?

public static void main(String[] args) {
    GLCanvas glCanvas;
    FPSAnimator animator;
    JFrame frame = new JFrame("JOGL HelloWorld");
    GLCapabilities caps = new GLCapabilities(null);

    caps.setDoubleBuffered(true);
    caps.setHardwareAccelerated(true);
    glCanvas = new GLCanvas(caps);
    glCanvas.setSize(800, 800);
    glCanvas.setIgnoreRepaint(true);
    glCanvas.addGLEventListener(new GLEventListener() {
        @Override
        public void reshape(GLAutoDrawable gLDrawable, int x, int y,
                int width, int height) {
        }

        @Override
        public void init(GLAutoDrawable gLDrawable) {
        }

        @Override
        public void dispose(GLAutoDrawable gLDrawable) {

        }

        @Override
        public void display(GLAutoDrawable gLDrawable) {
            FPSAnimator animator = (FPSAnimator) gLDrawable.getAnimator();
            System.out.println("animator.getLastFPS(): "
                    + animator.getLastFPS());
        }
    });

    frame.getContentPane().setLayout(new BorderLayout());
    frame.getContentPane().add(glCanvas, BorderLayout.CENTER);

    animator = new FPSAnimator(glCanvas, 30, false);
    frame.setSize(frame.getContentPane().getPreferredSize());
    frame.setVisible(true);
    animator.setUpdateFPSFrames(10, null);
    animator.start();
}
  • 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-06-13T04:47:26+00:00Added an answer on June 13, 2026 at 4:47 am

    The problem probably is being caused by an inaccuracy related to java.util.Timer.schedule(), which JOGL uses when initialized with any two-param constructors, or when the 3rd param, which is a flag for using fixed-rate scheduling, is set to false.


    When the flag is set to true, FPSAnimator will use java.util.Timer.scheduleAtFixedRate() instead, being considerably more consistent and accurate in terms of FPS.

    In specifics, using the flag as true will be particularly better in higher FPS, as the default is weak to delays and would begin to suffer from drifting, while using fixed-rate scheduling will execute an animation the correct number of times over a lengthy period, regardless of delays [source].


    Note however that, according to the response to the ticket responsible for this functionality being implemented, it is unclear whether the flag will cause excessive CPU consumption.

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

Sidebar

Related Questions

See code below. I've tried to strip it to its bare bones. I have
I have code that looks more or less like the code below but it
I have code below that is getting called from a while loop so it's
I have code below of an HTML page that includes a JS file. Function
I have code that overloads operator new . The code below works fine under
I have code below: <select id=testSelect> <option value=1>One</option> <option value=2>Two</option> </select> <asp:Button ID=btnTest runat=server
I have code as below: var s : String = hello world var xml
I have the code below. It looks long and complicated and now I have
I have the code below. void *timer1_function(void * eit); pthread_t timer1; int thread_check1 =
I have the code below which I use clone() and live() . The code

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.