Hi All,
I am really struggling with this problem.
I do a lot of 2D drawing onto a windowed screen, if my windowed screen app is running and the PC sleeps, or the workstation locks, or the desktop changes (example, connect an external display) the windowed screen turns grey and eventually app crashes on SpriteOutput() or FlipBuffers().
I read this is because the DirectX device is 'lost' and the sprites need to be restored.
How can we avoid this condition, or detect and restore from it?
Cheers,
Hip
[PB 5.40 LTS] Restore DirectX sprites after device lost
Re: [PB 5.40 LTS] Restore DirectX sprites after device lost
It's a known problem with DX9, and the DX11 subsystem should solve it. You can also try with the opengl subsystem it should handle this.
Re: [PB 5.40 LTS] Restore DirectX sprites after device lost
Hi Fred,
Thanks, but I cannot use the DirectX11 Subsystem - it does not work I believe my Intel HD onboard does not support it. Since my app must be used on a variety of hardware, DX9 seems to be a good option. OpenGL behaves very slowly for me also. I am only doing basic 2D stuff, no 3d, yet DirectX11 does not work, and OpenGL behaves too slow.
DX9 seems to be just perfect, and my users are happy except the lost device problem.
I came across this Purebasic Subsystem which has an identical interface, http://sourceforge.net/projects/dx9s/, it's written in Purebasic but I can't seem to compile it (with tailbite even) because it complains that the procedures already exist like ClearScreen() etc.
This Subsystem works, as the precompiled tests work fine when the workstation locks/unlocks.
Here is the original post for the subsystem http://www.purebasic.fr/english/viewtop ... 27&t=22184
This problem has been going on for a long time, someone says maybe you can give a callback to restore the sprites when device is lost?
Maybe some other way I can do it?
Cheers,
Hip
Thanks, but I cannot use the DirectX11 Subsystem - it does not work I believe my Intel HD onboard does not support it. Since my app must be used on a variety of hardware, DX9 seems to be a good option. OpenGL behaves very slowly for me also. I am only doing basic 2D stuff, no 3d, yet DirectX11 does not work, and OpenGL behaves too slow.
DX9 seems to be just perfect, and my users are happy except the lost device problem.
I came across this Purebasic Subsystem which has an identical interface, http://sourceforge.net/projects/dx9s/, it's written in Purebasic but I can't seem to compile it (with tailbite even) because it complains that the procedures already exist like ClearScreen() etc.
This Subsystem works, as the precompiled tests work fine when the workstation locks/unlocks.
Here is the original post for the subsystem http://www.purebasic.fr/english/viewtop ... 27&t=22184
This problem has been going on for a long time, someone says maybe you can give a callback to restore the sprites when device is lost?
Maybe some other way I can do it?
Cheers,
Hip
Re: [PB 5.40 LTS] Restore DirectX sprites after device lost
@hippy
What can I say, in my project screen is often stolen by other games [like CS 1.6] and I cannot even know when it happens. That's the same problem as yours and this is PB problem.
Using DX11 is not a solution - there are no DX11 runtime on Windows XP.
Using OpenGL only is not a solution too, it is much worst on windows than DX. Users always should be able to chose use DX or OpenGL.
The only way I see is using of external renderer - something like SDL [http://www.libsdl.org/].
It's usage is much complicated than build-in functions, but as result it should allow full control of screen and drawing. Don't know if there are actual bindings to PureBasic
What can I say, in my project screen is often stolen by other games [like CS 1.6] and I cannot even know when it happens. That's the same problem as yours and this is PB problem.
Using DX11 is not a solution - there are no DX11 runtime on Windows XP.
Using OpenGL only is not a solution too, it is much worst on windows than DX. Users always should be able to chose use DX or OpenGL.
The only way I see is using of external renderer - something like SDL [http://www.libsdl.org/].
It's usage is much complicated than build-in functions, but as result it should allow full control of screen and drawing. Don't know if there are actual bindings to PureBasic
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"