Alt freezing rendering Problem [Windows]
-
- Posts: 10
- Joined: Thu Sep 15, 2011 9:33 am
Alt freezing rendering Problem [Windows]
In Windows when I press alt and release it .. the rendering freezes and when I press space a menu opens at the title bar.
To resume the rendering i have to press alt again or some other key other than space.
Also i checked with the key pressed and release events.
It seems that after the alt key is released it freezes the rendering but when a the alt key is pressed again to resume rendering , the release event is sent.
A] How Do I Stop The Freezing? Because in linux(ubuntu) it does not freeze. Also In full screen the alt does not freeze the rendering.
B] Can Anyone explain me what actually happens and how to stop it?
C] Do I have to use win32api pgr to deal with it?
To resume the rendering i have to press alt again or some other key other than space.
Also i checked with the key pressed and release events.
It seems that after the alt key is released it freezes the rendering but when a the alt key is pressed again to resume rendering , the release event is sent.
A] How Do I Stop The Freezing? Because in linux(ubuntu) it does not freeze. Also In full screen the alt does not freeze the rendering.
B] Can Anyone explain me what actually happens and how to stop it?
C] Do I have to use win32api pgr to deal with it?
-
- Posts: 56
- Joined: Wed Nov 23, 2011 11:53 pm
Re: Alt freezing rendering Problem [Windows]
There is probably a thread yield in your main loop and pressing alt releases focus to the window.
Edit after rereading again a few times... I am actually not sure. But might as well check window focus issues anyway. You might have some kind of stuck key. Does it happen every time you launch you app? Does it happen even after restarting your computer? Because you know restarting windows fixes pretty much everything
Edit after rereading again a few times... I am actually not sure. But might as well check window focus issues anyway. You might have some kind of stuck key. Does it happen every time you launch you app? Does it happen even after restarting your computer? Because you know restarting windows fixes pretty much everything
-
- Posts: 10
- Joined: Thu Sep 15, 2011 9:33 am
Re: Alt freezing rendering Problem [Windows]
This is part of the output...
Event Occurred
Alt key pressed
Z:82 time Passed : 4
Z:83 time Passed : 4
Z:84 time Passed : 3
Z:85 time Passed : 33
Z:86 time Passed : 8
Z:87 time Passed : 3
Z:88 time Passed : 3
Z:89 time Passed : 8
Z:90 time Passed : 9
Z:91 time Passed : 2
Z:92 time Passed : 6
Z:93 time Passed : 3
Z:94 time Passed : 2
Z:95 time Passed : 3
Z:96 time Passed : 3
Z:97 time Passed : 6
Z:98 time Passed : 3
Z:99 time Passed : 4
Event Occurred
Alt key released
Z:100 time Passed : 4
Z:101 time Passed : 3798 [--Freeze here due to alt] [How to stop this]
Display FPS : 81 [--Resumes due to any key except space] [But the event is not received by IEventReceiver]
Z:102 time Passed : 2
Display FPS : 1
Z:103 time Passed : 1
Display FPS : 1
Z:104 time Passed : 2
Display FPS : 1
Z:105 time Passed : 4
Z:106 time Passed : 2
Z:107 time Passed : 3
Z:108 time Passed : 3
Z:109 time Passed : 4
Z:110 time Passed : 4
Z:111 time Passed : 3
Z:112 time Passed : 4
Z:113 time Passed : 2
Z:114 time Passed : 4
Z:115 time Passed : 17
Z:116 time Passed : 3
Z:117 time Passed : 4
Z:118 time Passed : 4
Z:119 time Passed : 8
Event Occurred
Alt key released
Z:120 time Passed : 11
Z:121 time Passed : 10
This is part of the code that show the output..
Restarting windows does not help and it happens every time when i launch the application.
Event Occurred
Alt key pressed
Z:82 time Passed : 4
Z:83 time Passed : 4
Z:84 time Passed : 3
Z:85 time Passed : 33
Z:86 time Passed : 8
Z:87 time Passed : 3
Z:88 time Passed : 3
Z:89 time Passed : 8
Z:90 time Passed : 9
Z:91 time Passed : 2
Z:92 time Passed : 6
Z:93 time Passed : 3
Z:94 time Passed : 2
Z:95 time Passed : 3
Z:96 time Passed : 3
Z:97 time Passed : 6
Z:98 time Passed : 3
Z:99 time Passed : 4
Event Occurred
Alt key released
Z:100 time Passed : 4
Z:101 time Passed : 3798 [--Freeze here due to alt] [How to stop this]
Display FPS : 81 [--Resumes due to any key except space] [But the event is not received by IEventReceiver]
Z:102 time Passed : 2
Display FPS : 1
Z:103 time Passed : 1
Display FPS : 1
Z:104 time Passed : 2
Display FPS : 1
Z:105 time Passed : 4
Z:106 time Passed : 2
Z:107 time Passed : 3
Z:108 time Passed : 3
Z:109 time Passed : 4
Z:110 time Passed : 4
Z:111 time Passed : 3
Z:112 time Passed : 4
Z:113 time Passed : 2
Z:114 time Passed : 4
Z:115 time Passed : 17
Z:116 time Passed : 3
Z:117 time Passed : 4
Z:118 time Passed : 4
Z:119 time Passed : 8
Event Occurred
Alt key released
Z:120 time Passed : 11
Z:121 time Passed : 10
This is part of the code that show the output..
Code: Select all
bool EventReceiver::OnEvent(const SEvent &event)
{
cout<<"Event Occurred\n";
if (event.EventType == EET_KEY_INPUT_EVENT){
if((event.KeyInput.Key == 164 || event.KeyInput.Key == 165) && event.KeyInput.PressedDown==false){
cout<<"Alt key released"<<"\n";
}
else if((event.KeyInput.Key == 164 || event.KeyInput.Key == 165) && event.KeyInput.PressedDown==true){
cout<<"Alt key pressed"<<"\n";
}
KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
}
else{
}
return false;
}
Code: Select all
while(device->run() && driver)
{
//Calculate FPS and game Update runs in a second
currentTime = device->getTimer()->getTime();
//TimePassed for 1 full game loop
u32 timePassed = currentTime-previousTime;
std::cout<<"Z:"<<z<<" time Passed : "<<timePassed<<"\n";
FPS_Calc_Counter +=timePassed;
//Check if counter has crossed over 1 second
if(FPS_Calc_Counter >= 1000){
FPS_Calc_Counter -= 1000;
DisplayFPS = FPS_Counter;
FPS_Counter = 0;
std::cout<<"Display FPS : "<<DisplayFPS<<'\n';
}
FPS_Counter++;
//reseting values for the loop
gameUpdateLoopCounter = 0;
previousTime = currentTime;
//Running the game Update loop
while(device->getTimer()->getTime() > nextUpdateCycle &&
gameUpdateLoopCounter < maxGameUpdateLoopCounter){
//std::cout<<"Game Update"<<"\n";
updateGame();
nextUpdateCycle += gameUpdateCycleSkip;
gameUpdateLoopCounter++;
}
//Calculating interpolation values
interpolationValue =
(device->getTimer()->getTime() - nextUpdateCycle + gameUpdateCycleSkip) / (float)gameUpdateCycleSkip;
//Displaying the game
drawScene(timePassed, interpolationValue);
z++;
}
Re: Alt freezing rendering Problem [Windows]
I just ran an Irrlicht app and hit the Alt key. The CPU utilisation went from 100% to 50%. I have two CPUs so it looks as if the Nvidia driver is being fed at 100% but then the feed stops when I hit Alt, but one CPU is still flat out. It looks as if Irrlicht is in a loop.
Can you profile your app to see where it has stopped. Or run it in the debugger and break when you hit Alt.
Can you profile your app to see where it has stopped. Or run it in the debugger and break when you hit Alt.
Re: Alt freezing rendering Problem [Windows]
We had the discussion in the past, but couldn't reproduce it back then as we got no code for it. Will try it again with your code when I'm back on Windows. Could please also say on which Windows you are (XP/Vista/7...)?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 10
- Joined: Thu Sep 15, 2011 9:33 am
Re: Alt freezing rendering Problem [Windows]
i cant break it after hitting alt cuz if the window looses focus it resumes rendering.
Also the gdb debugger does not show any abnormalities.
Though the cpu usage from 100% drops to less than 50% after the rendering freezes..
Also the gdb debugger does not show any abnormalities.
Though the cpu usage from 100% drops to less than 50% after the rendering freezes..
-
- Posts: 10
- Joined: Thu Sep 15, 2011 9:33 am
Re: Alt freezing rendering Problem [Windows]
@cute alien : windows 7
Re: Alt freezing rendering Problem [Windows]
If I remember correctly, if we were to stop this from happening then the user would also be unable to quit the program using ALT+F4. The correct way to do it in recent Windows versions is by using a low level keyboard hook, you may need to add that to CIrrDeviceWin32
Re: Alt freezing rendering Problem [Windows]
Can you tell which version of irrlicht are you using? it is a problem already solved on the SVN, but not on the distribution on the web (version 1.7.2)
It is an issue with the message handler of the window. It receives a message corresponding to the alt key that is normally used in conjunction with the menus (it should happen the same with the F10 key), hence, windows catches this message instead of irrlicht and waits for a key to be pressed, this freezes Irrlicht til a key is pressed, and continues the execution. This is still on the 1.7.2 version of the web, but it is not on the SVN, it has ben handled, and now the irrlicht apps read the alt key correctly.
So, it is better that you get the SVN version and work with it. And no, you don't need to use any other api.
It is an issue with the message handler of the window. It receives a message corresponding to the alt key that is normally used in conjunction with the menus (it should happen the same with the F10 key), hence, windows catches this message instead of irrlicht and waits for a key to be pressed, this freezes Irrlicht til a key is pressed, and continues the execution. This is still on the 1.7.2 version of the web, but it is not on the SVN, it has ben handled, and now the irrlicht apps read the alt key correctly.
So, it is better that you get the SVN version and work with it. And no, you don't need to use any other api.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: Alt freezing rendering Problem [Windows]
Is it still in 1.7 the branch?
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Alt freezing rendering Problem [Windows]
Well, this is some behaviour which is not necessarily considered a bug, so we don't change it in the stable branches.
Re: Alt freezing rendering Problem [Windows]
But it is unexpected. Taking into account that irrlicht handles keyboard input, more than a bug it is an undesired behavior.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: Alt freezing rendering Problem [Windows]
We have to be careful with that kind of glitch. If this only happens on Windows 7, maybe even just in windowed mode then it sounds like a system key which is handled correctly - except maybe for some games which want to catch that key for themselves. We can't just break that in stable branches or we break applications which just want to behave like nice Windows applications (and if that's the reason we maybe shouldn't even change it at all...). You get for example also menus with alt+space on some Linux Windowmanagers, but I don't see that as bug, but as the usual way to receive that menu (and yeah - such behavior can be annoying with games occasionally especially if window-managers make it hard to disable that stuff per application or even make it hard disabling it per script).
But at least having a workaround would certainly be nice.
But at least having a workaround would certainly be nice.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Alt freezing rendering Problem [Windows]
It also happens on Windows XP (at least on mine ). I didn't really see it as a bug but as a "strange windows feature", but it would be nice if this was changed.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
-
- Posts: 1010
- Joined: Mon Oct 24, 2011 10:03 pm
- Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d
Re: Alt freezing rendering Problem [Windows]
doesn't happen when I try to replicate. works like a charm (Got win xp/Ubuntu dual boot)
"this is not the bottleneck you are looking for"