PDA

View Full Version : Render Freeze - Please Help



mancunian
12-08-2006, 01:42 AM
I am a noobie here and to UnDelphiX so please excuse me if this is a stupid question :?

When rendering in windowed mode, using the DXTimer (OnTimer Event) or Application.Idle method, if i drag the Form Window on screen or display a pop-up menu the rendering freezes until i stop dragging or i close the pop-up :(

Can anyone out there explain what i am doing wrong and show me the right way to fix this problem. I would like my Form Window to behave like Windows Media Player. While you drag the player around the screen or pop-up a menu it continues to play the video/movie in real-time (No Render Freezing!) 8)

Andreaz
12-08-2006, 06:36 AM
Try setting the timer's ActiveOnly to false and see if that helps.

WILL
12-08-2006, 09:11 AM
Please refrain from double posting. It makes unessissary mess and causes confusion when trying to resolve complex issues. Thanks, and welcome to PGD. :)

mancunian
12-08-2006, 09:49 AM
Thanks WILL and sorry for the double post :oops:

Hi Andreaz, I tried it and it didn't help :cry:

In fact the same happens (Render freezing) even when not using UnDelphiX (i.e. just using and ordinary TForm and and a TBitmap Canvas to draw on. I'm wondering if Windows is suppressing certain Events like OnIdle or OnTimer when dragging a window or pop-up menus are on screen?

Huehnerschaender
12-08-2006, 11:19 AM
Did you already try to add the following line in your OnIdle/OnTimer event?

Application.ProcessMessages;

Maybe this helps, but I am not an (Un)DelphiX expert... I don't know how the timer works.

mancunian
12-08-2006, 11:35 AM
Hi Huehnerschaender, I tried that and it didn't work. I can move the mouse cursor, click/press keys/buttons etc and it all works smoothly with rendering updating OK. Then as soon as i drag the window, or right click my pop-up menu, rendering freezes and only unfreezes when i cease dragging or close the pop-up. I'm mystified :?

Huehnerschaender
12-08-2006, 12:18 PM
I just tried out my actual project in windowed mode. Dragged the window and it stops rendering, too. So your problem is no DelphiX problem I guess. It must be something about the window handling of Windows itself. I don't use (Un)DelphiX in my project, so I am sure the problem does not relate to it.

savage
12-08-2006, 04:54 PM
I may be wrong, but my understanding is that the action of clicking to begin dragging the window stops other Windows message processing. Hence why it stops. Can anyone on Linux confirm that this happens on Linux as well. In either case it's the way that the Windows messaging subsystem is written.

Huehnerschaender
12-08-2006, 05:34 PM
But there must be a way to avoid this, because there are applications which do not stop working when being dragged.

tanffn
12-08-2006, 06:14 PM
Don’t have the time to test it right now, but I think that it will stop the primary/gui thread. So maybe if you’ll run a second thread that will do the actual processing and drawing it will still work.

If non of you will I can try and test it tomorrow.

savage
12-08-2006, 06:21 PM
But there must be a way to avoid this, because there are applications which do not stop working when being dragged.

Can you name any Microsoft applications that do this?

tanffn
12-08-2006, 06:23 PM
Can you name any Microsoft applications that do this?

IE :) if you move the window while a page is loading the logo will still be updated, same goes for the inpage animations.

mancunian
12-08-2006, 07:03 PM
But there must be a way to avoid this, because there are applications which do not stop working when being dragged.

Can you name any Microsoft applications that do this?

Yes as i said earlier Windows Media Player continues to play video while being dragged as do most other non-Microsoft players. Don't know how they manage it :(


Don’t have the time to test it right now, but I think that it will stop the primary/gui thread. So maybe if you’ll run a second thread that will do the actual processing and drawing it will still work.

If non of you will I can try and test it tomorrow.

Thanks. I'm not familiar with threaded apps, so if you do get it to work could you please post the code for the setup/render loop :D

Robert Kosek
12-08-2006, 07:52 PM
Yes as i said earlier Windows Media Player continues to play video while being dragged as do most other non-Microsoft players. Don't know how they manage it :( Easy. You never grab the window frame, but a panel within the frame (an imitation window frame if you will) that permits a drag while rendering.

Otherwise, if you use a standard window all I can say is "Tough luck", because it's a Microsoft-ism. You'll have to ask them why they did it that way. :)

tanffn
13-08-2006, 08:39 AM
Windows Media Player and most of the players don't render using the stander GUI/Desktop overlay and they are not even in charge of the decoding/rendering.. so its not really a good comparison.

tanffn
13-08-2006, 08:58 AM
Done some testing and when you drag a window (on mouse move) the app will freeze, its much more noticeable if you press (and not release) the X of the window.
If you play an MP3 in Windows Media Player It will also stop the animation but not the sound, if you play a video file its again not controlled in the same thread + overlay.

I guess the only way to fully bypass it is by creating your own GUI (i.e Winamp, QuickTime Player), am I wrong?

EDIT: OOPS :oops: I does work, I uploaded a Threaded demo to:
www.global-rd.com/ariel/freeze.zip

savage
13-08-2006, 09:09 AM
I was messing around with one of the JEDI-SDL timer demos yesterday, and I think moving the animation to a secondary thread may work. Again it would need to be tested. But I have to ask, is it such a bad thing to have the animation stop when you are dragging the Window?

tanffn
13-08-2006, 09:25 AM
I was messing around with one of the JEDI-SDL timer demos yesterday, and I think moving the animation to a secondary thread may work. Again it would need to be tested. But I have to ask, is it such a bad thing to have the animation stop when you are dragging the Window?

It should work, as even in my above demo I made it work with TImage.

czar
13-08-2006, 09:38 AM
Hi Tanffn

Your demo does not work for me. It counts up at the most to 13 or so and then image stops being drawn to. This occurs even if I don't move the mouse or anything.

tanffn
13-08-2006, 10:05 AM
Hi Tanffn

Your demo does not work for me. It counts up at the most to 13 or so and then image stops being drawn to. This occurs even if I don't move the mouse or anything.

What can I say czar.. it works fine here, tested it several times until I gave up (300-600).

How many times did you try? You can always look at the code as its very straight forward.
I'm using XP Pro sp2, whats your spec?

mancunian
13-08-2006, 12:58 PM
Hi Tanffn

Your demo does not work for me. It counts up at the most to 13 or so and then image stops being drawn to. This occurs even if I don't move the mouse or anything.

What can I say czar.. it works fine here, tested it several times until I gave up (300-600).

How many times did you try? You can always look at the code as its very straight forward.
I'm using XP Pro sp2, whats your spec?

It works fine for me. I have XP Pro sp2 as well. Well done tanffn :D

mancunian
13-08-2006, 01:03 PM
I was messing around with one of the JEDI-SDL timer demos yesterday, and I think moving the animation to a secondary thread may work. Again it would need to be tested. But I have to ask, is it such a bad thing to have the animation stop when you are dragging the Window?

It's not a bad thing (may even be preferable to some). But it does add a professional touch to the app 8)

Huehnerschaender
13-08-2006, 01:20 PM
Generally it works for me, but in your demo, the TImage freezes after several drags.... Then it doesn't render anymore, no matter if I drag or not.

Greetings,
Dirk

WinXP SP2

tanffn
13-08-2006, 03:14 PM
Donno Huehnerschaender, maybe its something todo with TImage or TCavas and the fact that I didn't sync..
Anyway it was only to show the genral idea, I stated in the code its not the "proper way".
If many insist on working with Timage (which I doubt) I can debug the app.. :?

What's your computer spec? maybe its something to do with the CPU or its utilization(?)
I tested it on K7-1200, 1GB ram, with a crappy PCI video card. i'll try it at home as well.

mancunian
13-08-2006, 03:56 PM
Generally it works for me, but in your demo, the TImage freezes after several drags.... Then it doesn't render anymore, no matter if I drag or not.

Greetings,
Dirk

WinXP SP2

I get the same effect but very infrequently. Sometimes the TImage disappears altogether, but the other form labels continue to update :?

czar
13-08-2006, 06:09 PM
The numbers in the timage stop updating after a short time. The image itself often dissapears. Numbers don't usually go higher than 10-15. I have run it about 6-8 times. Even recompiled it.

This is on windows xp sp2. 3 Ghz hyper threaded cpu, nividia 7800gs.

I go it to run up to 78 just before.

tanffn
13-08-2006, 06:26 PM
Tried it at home, XP3500-939pin (or something like that :roll: ) and I did encounter this problem as well..
The Image will disappear when you hide the window (move something over it) / background redraw as it is draws to the canvas.

NO idea way, first time I’ve seen it this kind of problem.. I wander where does the Image go.. :eh:

seiferalmasy
17-08-2006, 12:10 AM
This might have been said, and I might be behind. The rendering stops if form is set to Drag mode. Set the main form to dock.

In dock mode, clicking the main bar will not stop the timers or anything else. I had this very same problem with my project, it seems threaddedtimer carries on, dxtimer and other processes completely stop.

Use:

Object insprector Dragkind>>DKdock