cxgeorge 23 years ago
parent
commit
428fcbc839
1 changed files with 3 additions and 2 deletions
  1. 3 2
      panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx

+ 3 - 2
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?)
     // may persist across dx_init's?  (for dx8.1 but not dx8.0?)
     _CurVertexShader = _CurPixelShader = NULL;
     _CurVertexShader = _CurPixelShader = NULL;
+    _pGlobalTexture = NULL;
 
 
     //    _max_light_range = __D3DLIGHT_RANGE_MAX;
     //    _max_light_range = __D3DLIGHT_RANGE_MAX;
 
 
@@ -523,7 +524,7 @@ free_d3d_device(void) {
     _bDXisReady = false;
     _bDXisReady = false;
     
     
     if(scrn.pD3DDevice!=NULL)
     if(scrn.pD3DDevice!=NULL)
-     for(int i=0;D3D_MAXTEXTURESTAGES;i++)
+     for(int i=0;i<D3D_MAXTEXTURESTAGES;i++)
          scrn.pD3DDevice->SetTexture(i,NULL);  // d3d should release this stuff internally anyway, but whatever
          scrn.pD3DDevice->SetTexture(i,NULL);  // d3d should release this stuff internally anyway, but whatever
 
 
     DeleteAllDeviceObjects();
     DeleteAllDeviceObjects();
@@ -4575,7 +4576,7 @@ dx_cleanup(bool bRestoreDisplayMode,bool bAtExitFnCalled) {
     // Do a safe check for releasing the D3DDEVICE. RefCount should be zero.
     // 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 we're called from exit(), scrn.pD3DDevice may already have been released
     if (scrn.pD3DDevice!=NULL) {
     if (scrn.pD3DDevice!=NULL) {
-        for(int i=0;D3D_MAXTEXTURESTAGES;i++)
+        for(int i=0;i<D3D_MAXTEXTURESTAGES;i++)
            scrn.pD3DDevice->SetTexture(i,NULL);  // d3d should release this stuff internally anyway, but whatever
            scrn.pD3DDevice->SetTexture(i,NULL);  // d3d should release this stuff internally anyway, but whatever
         RELEASE(scrn.pD3DDevice,dxgsg,"d3dDevice",RELEASE_DOWN_TO_ZERO);
         RELEASE(scrn.pD3DDevice,dxgsg,"d3dDevice",RELEASE_DOWN_TO_ZERO);
     }
     }