Problem with primary device + alt tab

BlitzMax Forums/BlitzMax Programming/Problem with primary device + alt tab

Filax(Posted 2006) [#1]
Hi :)

I have a problem with a primary device and alt tab ?
when a made a ALT TAB the program crash at this line

"PrimaryDevice.device.DrawPrimitive(RenderType,D...."

Is there a way to stop the rendering/freeze rendering
to prevent ALT TAB crash ?




Filax(Posted 2006) [#2]
I have try to find DX doc about this and there is a command

DeviceLost

But i don't know how use it ?




DStastny(Posted 2006) [#3]
Try checking this variable..

TD3D7Max2DDriver(_max2dDriver).IsLost before attempting to play with the PrimaryDevice


Doug Stastny


Filax(Posted 2006) [#4]
Many thanks budman !!! it work !

Here is the code




DStastny(Posted 2006) [#5]
Great glad to have helped.

Comment on your code. DrawPrimative must be between BeginScene, EndScene.

The 2d driver manages the Scene State so you shouldnt need EndScene.. BeginScene. I am suprised it works. Some cards might not though.


If TD3D7Max2DDriver(_max2dDriver).IsLost=False
	        TD3D7Max2DDriver(_max2dDriver).SetActiveFrame(DXFrame)
' not needed			PrimaryDevice.Device.EndScene() 
	        PrimaryDevice.device.DrawPrimitive(RenderType,D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX1,xyuv,segs,0)
' not needed			PrimaryDevice.Device.BeginScene()
		EndIf



Doug Stastny