Hello
When I run some demo programs, these run slowly. A window will be refreshed sometimes.
For example, when I run 06.2DGraphics, 2 imps flutter their wings about 1 time per sec (= 1FPS).
But when I run 01.HelloWorld and Demo, these run smoothly.
I think 2D programs are slow and 3D are fast.
This problem can be applied to my own program which uses draw2DImage().
My environment are listed below.
Irrlicht Engine version 1.7.2 (not apt package, I compiled it using g++ 4.6.1 and g++ 4.5.2)
Ubuntu 11.04 (Linux 2.6.38-11-generic-pae #48-Ubuntu SMP Fri Jul 29 20:51:21 UTC 2011 i686)
GeForce GTX 285 with NVIDIA Driver Version 280.13
And I found a quick-fix solution for this problem.
It is to select "Ubuntu Ubuntu(Safety mode)" or "Ubuntu Classic(no effect)" on login window.
I think compiz harms Irrlicht functions.
I don't know whether this problem is a bug of Irrlicht or not,
but I think many people are in trouble with this problem and I posted here.
I will be happy if this problem is fixed.
Thanks,
Some demo apps run slowly on ubuntu 11.04
Re: Some demo apps run slowly on ubuntu 11.04
I think I had this problem too, but then again most problems I had was the unity interface it self (too messy interface for me to work on ) so I just got rid of it. You should probably try posting this also on ubuntu forums.
Working on game: Marrbles (Currently stopped).
Re: Some demo apps run slowly on ubuntu 11.04
just put device->sleep(1); in the main run loop
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
-- https://github.com/netpipe/Luna Game Engine Status 95%
Re: Some demo apps run slowly on ubuntu 11.04
That's sort of a bad solution. Why would this even help with frame rate?tecan wrote:just put device->sleep(1); in the main run loop
Working on game: Marrbles (Currently stopped).
Re: Some demo apps run slowly on ubuntu 11.04
Thank you for the information.tecan wrote:just put device->sleep(1); in the main run loop
I put it in the main loop, and the program runs smoothly.
I experimented with putting a for loop instead of device->sleep(1).
Code: Select all
while (device->run()) {
if (device->isWindowActive()) {
...
for (volatile int i = 0; i < 350000; ++i) ;
...
}
}
I found that a high frame rate causes the problem.
When the frame rate is too high (e.g. 4000FPS), I encounter the problem.
When I limit the frame rate (less than about 900FPS), the program runs smoothly.
I think that too high frame rate exhausts time for refreshing a window.
Re: Some demo apps run slowly on ubuntu 11.04
Oh I get why the problem happens now, but these two ways are still not the way to limit framerate because on lower end computers it may just make the app run too slow. You should instead use delta times between frames and pause for some time to make the time between frames the same(eg 16.666666ms for 60fps).uchan wrote:Thank you for the information.tecan wrote:just put device->sleep(1); in the main run loop
I put it in the main loop, and the program runs smoothly.
I experimented with putting a for loop instead of device->sleep(1).The frame rate can be adjusted by changing "350000".Code: Select all
while (device->run()) { if (device->isWindowActive()) { ... for (volatile int i = 0; i < 350000; ++i) ; ... } }
I found that a high frame rate causes the problem.
When the frame rate is too high (e.g. 4000FPS), I encounter the problem.
When I limit the frame rate (less than about 900FPS), the program runs smoothly.
I think that too high frame rate exhausts time for refreshing a window.
Working on game: Marrbles (Currently stopped).
Re: Some demo apps run slowly on ubuntu 11.04
That's right.serengeor wrote:Oh I get why the problem happens now, but these two ways are still not the way to limit framerate because on lower end computers it may just make the app run too slow. You should instead use delta times between frames and pause for some time to make the time between frames the same(eg 16.666666ms for 60fps).
I created FrameTimingProvider class that provides the end time of each frames.
The class can be used like this.
Code: Select all
FrameTimingProvider provider(60); // set a preferred frame rate
provider.set_base_time(timer->getTime()); // set the initial time
while (device->run()) {
// do game logic
now = timer->getTime();
if (now < *provider) { // if the current time < the end time of this frame
// draw all
}
now = timer->getTime();
if (now < *provider) {
device->sleep(*provider - now); // if there is spare time, sleep till the start time of the next frame.
}
++provider; // advances a frame.
}