Page 1 of 2
Alt freezing rendering Problem [Windows]
Posted: Mon Jan 09, 2012 9:27 am
by switchblade_77
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?
Re: Alt freezing rendering Problem [Windows]
Posted: Mon Jan 09, 2012 8:20 pm
by shadowghost21
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

Re: Alt freezing rendering Problem [Windows]
Posted: Wed Jan 11, 2012 9:54 am
by switchblade_77
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..
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++;
}
Restarting windows does not help and it happens every time when i launch the application.
Re: Alt freezing rendering Problem [Windows]
Posted: Wed Jan 11, 2012 11:36 am
by mongoose7
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.
Re: Alt freezing rendering Problem [Windows]
Posted: Wed Jan 11, 2012 11:53 am
by CuteAlien
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...)?
Re: Alt freezing rendering Problem [Windows]
Posted: Wed Jan 11, 2012 11:54 am
by switchblade_77
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..
Re: Alt freezing rendering Problem [Windows]
Posted: Wed Jan 11, 2012 11:57 am
by switchblade_77
@cute alien : windows 7
Re: Alt freezing rendering Problem [Windows]
Posted: Wed Jan 11, 2012 1:49 pm
by bitplane
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]
Posted: Wed Jan 11, 2012 11:13 pm
by Mel
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.
Re: Alt freezing rendering Problem [Windows]
Posted: Thu Jan 12, 2012 3:38 pm
by hendu
Is it still in 1.7 the branch?
Re: Alt freezing rendering Problem [Windows]
Posted: Thu Jan 12, 2012 9:26 pm
by hybrid
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]
Posted: Fri Jan 13, 2012 1:31 am
by Mel
But it is unexpected. Taking into account that irrlicht handles keyboard input, more than a bug it is an undesired behavior.
Re: Alt freezing rendering Problem [Windows]
Posted: Fri Jan 13, 2012 2:41 am
by CuteAlien
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.
Re: Alt freezing rendering Problem [Windows]
Posted: Fri Jan 13, 2012 5:19 am
by Brainsaw
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.
Re: Alt freezing rendering Problem [Windows]
Posted: Fri Jan 13, 2012 8:20 am
by Cube_
doesn't happen when I try to replicate. works like a charm

(Got win xp/Ubuntu dual boot)