if(!_Dx9Device)
return E_FAIL;
if(_backBuffer)
{
_backBuffer->Release();
_backBuffer=NULL;
}
if(_depthBuffer)
{
_depthBuffer->Release();
_depthBuffer=NULL;
}
HRESULT hr=_Dx9Device->Reset(&_Dx9params);
switch (hr)
{
case D3DERR_DEVICELOST: return E_FAIL;break;
case D3DERR_DRIVERINTERNALERROR: return E_FAIL;break;
case D3DERR_INVALIDCALL: return E_FAIL;break;
case D3DERR_OUTOFVIDEOMEMORY: return E_FAIL;break;
case E_OUTOFMEMORY: return E_FAIL;break;
}
if (hr = FAILED(_Dx9Device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &_backBuffer)))
return SX_FAIL;
if (hr = FAILED(_Dx9Device->GetDepthStencilSurface(&_depthBuffer)))
return SX_FAIL;
return hr;
}
~Main
Primitives appear black after Reset()
I've recently added lost device recovery to my system.
During a device loss, i release all the objects, call Reset(params) and reinitalize all my objects.
A white primitive, w/o any texture applied to it, shows up black after a reset
If a texture is applied, the texture dissapers, and just the black quad renders
Also, after this reset, Any data loaded (ie if i wait until after the reset to load the texture) has the same characteristics as if it were loaded before the reset.
I'm wondering if this has anything to do with releasing and regaining my back buffer before and after a reset?
my reset
I get the same result without using a texture at all.
If i'm just displaying the quad, it's color goes from white, to black, after a reset
~Main
If i'm just displaying the quad, it's color goes from white, to black, after a reset
~Main
On Reset, all renderstates and settings are lost. Your init code probably turns lighting off, sets up a projection matrix, etc. All this should be done again. I suspect lighting is what's making everything black.
Move all your initialization code to a seperate function, and call it both at init time and after a reset.
Move all your initialization code to a seperate function, and call it both at init time and after a reset.
Yup. It's most likely your lighting. Needs to be recreated.
Alternatively, if you just set the material once at the start, you may need to do it again after Reset().
Alternatively, if you just set the material once at the start, you may need to do it again after Reset().
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement