diff --git a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx index 535d4c98a0..bf4289b382 100644 --- a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx +++ b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx @@ -467,6 +467,7 @@ DXGraphicsStateGuardian(GraphicsWindow *win) : GraphicsStateGuardian(win) { // may persist across dx_init's? (for dx8.1 but not dx8.0?) _CurVertexShader = _CurPixelShader = NULL; + _pGlobalTexture = NULL; // _max_light_range = __D3DLIGHT_RANGE_MAX; @@ -523,7 +524,7 @@ free_d3d_device(void) { _bDXisReady = false; if(scrn.pD3DDevice!=NULL) - for(int i=0;D3D_MAXTEXTURESTAGES;i++) + for(int i=0;iSetTexture(i,NULL); // d3d should release this stuff internally anyway, but whatever DeleteAllDeviceObjects(); @@ -4575,7 +4576,7 @@ dx_cleanup(bool bRestoreDisplayMode,bool bAtExitFnCalled) { // Do a safe check for releasing the D3DDEVICE. RefCount should be zero. // if we're called from exit(), scrn.pD3DDevice may already have been released if (scrn.pD3DDevice!=NULL) { - for(int i=0;D3D_MAXTEXTURESTAGES;i++) + for(int i=0;iSetTexture(i,NULL); // d3d should release this stuff internally anyway, but whatever RELEASE(scrn.pD3DDevice,dxgsg,"d3dDevice",RELEASE_DOWN_TO_ZERO); }