浏览代码

Fixed a minor bug

Josh Yelon 19 年之前
父节点
当前提交
452923116d

+ 7 - 11
panda/src/wgldisplay/wglGraphicsBuffer.cxx

@@ -91,10 +91,8 @@ begin_frame(FrameMode mode) {
     }
     }
   }
   }
 
 
-  wglGraphicsPipe *wglpipe;
-  DCAST_INTO_R(wglpipe, _pipe, false);
-  wglpipe->wgl_make_current(_pbuffer_dc, wglgsg->get_context(_pbuffer_dc),
-                            &_make_current_pcollector);
+  wglGraphicsPipe::wgl_make_current(_pbuffer_dc, wglgsg->get_context(_pbuffer_dc),
+                                    &_make_current_pcollector);
   
   
   if (mode == FM_render) {
   if (mode == FM_render) {
     begin_render_texture();
     begin_render_texture();
@@ -309,10 +307,8 @@ open_buffer() {
     return false;
     return false;
   }
   }
 
 
-  wglGraphicsPipe *wglpipe;
-  DCAST_INTO_R(wglpipe, _pipe, false);
-  wglpipe->wgl_make_current(twindow_dc, wglgsg->get_context(twindow_dc),
-                            &_make_current_pcollector);
+  wglGraphicsPipe::wgl_make_current(twindow_dc, wglgsg->get_context(twindow_dc),
+                                    &_make_current_pcollector);
   wglgsg->reset_if_new();
   wglgsg->reset_if_new();
 
 
   // Now that we have fully made a window and used that window to
   // Now that we have fully made a window and used that window to
@@ -320,14 +316,14 @@ open_buffer() {
   // This might fail if the pbuffer extensions are not supported.
   // This might fail if the pbuffer extensions are not supported.
 
 
   if (!make_pbuffer(twindow_dc)) {
   if (!make_pbuffer(twindow_dc)) {
-    wglpipe->wgl_make_current(0, 0, &_make_current_pcollector);
+    wglGraphicsPipe::wgl_make_current(0, 0, &_make_current_pcollector);
     return false;
     return false;
   }
   }
 
 
   _pbuffer_dc = wglgsg->_wglGetPbufferDCARB(_pbuffer);
   _pbuffer_dc = wglgsg->_wglGetPbufferDCARB(_pbuffer);
   
   
-  wglpipe->wgl_make_current(_pbuffer_dc, wglgsg->get_context(_pbuffer_dc),
-                            &_make_current_pcollector);
+  wglGraphicsPipe::wgl_make_current(_pbuffer_dc, wglgsg->get_context(_pbuffer_dc),
+                                    &_make_current_pcollector);
   wglgsg->report_my_gl_errors();
   wglgsg->report_my_gl_errors();
   
   
   _is_valid = true;
   _is_valid = true;

+ 1 - 0
panda/src/wgldisplay/wglGraphicsStateGuardian.cxx

@@ -308,6 +308,7 @@ make_context(HDC hdc) {
   _made_context = true;
   _made_context = true;
 
 
   // Attempt to create a context.
   // Attempt to create a context.
+  wglGraphicsPipe::_current_valid = false;
   _context = wglCreateContext(hdc);
   _context = wglCreateContext(hdc);
 
 
   if (_context == NULL) {
   if (_context == NULL) {

+ 3 - 9
panda/src/wgldisplay/wglGraphicsWindow.cxx

@@ -174,9 +174,7 @@ begin_frame(FrameMode mode) {
   HGLRC context = wglgsg->get_context(_hdc);
   HGLRC context = wglgsg->get_context(_hdc);
   nassertr(context, false);
   nassertr(context, false);
   
   
-  wglGraphicsPipe *wglpipe;
-  DCAST_INTO_R(wglpipe, _pipe, false);
-  wglpipe->wgl_make_current(_hdc, context, &_make_current_pcollector);
+  wglGraphicsPipe::wgl_make_current(_hdc, context, &_make_current_pcollector);
   wglgsg->reset_if_new();
   wglgsg->reset_if_new();
 
 
   if (mode == FM_render) {
   if (mode == FM_render) {
@@ -242,9 +240,7 @@ begin_flip() {
     DCAST_INTO_V(wglgsg, _gsg);
     DCAST_INTO_V(wglgsg, _gsg);
     HGLRC context = wglgsg->get_context(_hdc);
     HGLRC context = wglgsg->get_context(_hdc);
     nassertv(context);
     nassertv(context);
-    wglGraphicsPipe *wglpipe;
-    DCAST_INTO_V(wglpipe, _pipe);
-    wglpipe->wgl_make_current(_hdc, context, &_make_current_pcollector);
+    wglGraphicsPipe::wgl_make_current(_hdc, context, &_make_current_pcollector);
     SwapBuffers(_hdc);
     SwapBuffers(_hdc);
   }
   }
 }
 }
@@ -258,9 +254,7 @@ begin_flip() {
 void wglGraphicsWindow::
 void wglGraphicsWindow::
 close_window() {
 close_window() {
   if (_gsg != (GraphicsStateGuardian *)NULL) {
   if (_gsg != (GraphicsStateGuardian *)NULL) {
-    wglGraphicsPipe *wglpipe;
-    DCAST_INTO_V(wglpipe, _pipe);
-    wglpipe->wgl_make_current(_hdc, NULL, &_make_current_pcollector);
+    wglGraphicsPipe::wgl_make_current(_hdc, NULL, &_make_current_pcollector);
     _gsg.clear();
     _gsg.clear();
     _active = false;
     _active = false;
   }
   }