Welcome! Log In Create A New Profile

Advanced

Linux and Windows FPS differ?

Posted by malberts 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
avatar Linux and Windows FPS differ?
March 28, 2009 04:05PM
I wrote the spinning man for assignment 1 under linux and then when I ran it under windows the speed was super slow.

Under linux it took the man ~7 seconds to do a full 360 degree rotation using 0.01 degree increments.
Under windows it took ~85 seconds to do a full 360 degree rotation using 0.05 degree increments.

Some old unisa code run slower on windows too.

Could this be because openGL uses a default FPS that differs on these platforms? Or something else that is implemented differently?
Re: Linux and Windows FPS differ?
March 28, 2009 06:11PM
Sure you have OpenGL correctly installed under Windows? Just a question, as I had a corrupt OpenGL installation many moons ago.

If the old code mentioned has nothing to do with OpenGL libraries, then its something else...
avatar Re: Linux and Windows FPS differ?
March 28, 2009 06:27PM
I tested my program, and the unisa program, on another windows pc and it was just as slow. I did everything unisa told me to do to set it up. The old unisa code is an opengl program from 2006.

But I was thinking that maybe the (slow) windows speed is the intended speed that unisa wants and that linux runs it too fast. So I'll just have to modify the code to make it run slower on windows.

Could I perhaps email you the code/binary so you can test it on another windows pc for me?
Anonymous User
Re: Linux and Windows FPS differ?
March 30, 2009 02:46PM
I have something similar between OpenGL projects on the same machine. I used an example from http://www.spacesimulator.net/tut2_opengl.html and it runs well timed, good refresh, steady, etc.

I then wrote my own and the refresh is too fast. My stick man spins so quickly you can hardly see it. Its just not obvious to me what controls the refresh rate of the display() function, i.e. what calls its and at what interval. I'm using a call to glutIdleFunc(display) for the animation...

What I'm missing is a way of controlling the refresh rate

My assumption here is that you're affected by this as well, somewhere between the installations is something that determines a default refresh rate...
avatar Re: Linux and Windows FPS differ?
March 30, 2009 02:57PM
Here's what I found out:

* OpenGL is only a graphics API. It does not control the speed of what happens. It doesn't have timers or anything.
* If you want controlled FPS then you must implement something like a game loop (update, draw, sleep). But this is done in C++ and not in OpenGL directly.

What I couldn't find out:

* Why is the difference so huge? Is windows struggling with basic maths or drawing basic lines?

"I have something similar between OpenGL projects on the same machine. I used an example from [www.spacesimulator.net]"

It runs ok on linux here. I'll check on windows in a sec. But all of the book's code also goes much faster on linux than on windows.

[edit]
Windows is as slow as expected.

I did find something called glutTimerFunc - I realised that openGL isn't supposed to control the FPS. GLUT is.
So see here but that doesn't seem to work for me.
Anonymous User
Re: Linux and Windows FPS differ?
March 30, 2009 04:25PM
What's the drain on the CPU when running under windows? it is obvious that the program is running flat out?
avatar Re: Linux and Windows FPS differ?
March 30, 2009 04:43PM
For that spacesimulator program windows uses <5% CPU, linux uses <100%.

When I resize the windows window the movement remains constant . But when I resize on linux it gets slower.

So I'm not sure whether the problem is that windows is too slow, or that linux is too fast. It might be that the windows GLUT controls its FPS better than freeGLUT on linux.
Anonymous User
Re: Linux and Windows FPS differ?
March 30, 2009 04:58PM
Okay, so if the Windows version isn't burning up the CPU then it surely means that something in the code, or the setup is releasing it to the OS more often, i.e. a sleep statement, or some other control, something you cannot set...

I think this comes back to the refresh rate, it should be possible to time the intervals that display() is called and compare that between the systems. If the actual gl..() functions were more CPU intensive on Windows then I'd expect to see the CPU usage figures the other way around, my guess is that your Linux versions simply runs tighter than windows.

Are you using glutIdleFunc( display ) for the animation trigger ?

As I understand it, animating at a desired FPS will require the use of a timer that triggers every nth of a second. This is implemented is such a way that if the desired FPS cannot be achieved the frames are skipped. glutIdleFunc() is not timer bound and triggers whenever there's a gap - I'm not sure how the OS tells the program there idle time

In my case I am submitting the assignment as is and getting going with other modules...
avatar Re: Linux and Windows FPS differ?
March 30, 2009 05:10PM
I submitted mine anyway too. This assignment isn't really affected by this.

To animate at a desired FPS you need to implement a loop like:
- take system time
- update everything
- draw everything
- take system time
- compare times
- if it took too long, skip some future frames (or calculate the next frame using a longer elapsed time), else sleep

But thats why they say GLUT shouldn't be used for advanced programs because it's only meant to implement the basic functions available across all OS's. And I think GLUT is mostly used only to learn openGL.
Re: Linux and Windows FPS differ?
August 21, 2009 07:57AM
it's because windows is a resource glutton... the only reason...
avatar Re: Linux and Windows FPS differ?
November 02, 2009 04:12AM
36187844 Wrote:
-------------------------------------------------------
> it's because windows is a resource glutton... the
> only reason...

uh huh eye rolling smiley
Anonymous User
Re: Linux and Windows FPS differ?
November 02, 2009 06:38AM
Sorry, only registered users may post in this forum.

Click here to login