瀏覽代碼

properly uninvert framebuffer-to-texture

David Rose 17 年之前
父節點
當前提交
990e0883de
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 2 2
      panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx
  2. 1 1
      panda/src/tinydisplay/tinyXGraphicsWindow.cxx

+ 2 - 2
panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx

@@ -1392,11 +1392,11 @@ framebuffer_copy_to_texture(Texture *tex, int z, const DisplayRegion *dr,
   GLTexture *gltex = gtc->_gltex;
   GLTexture *gltex = gtc->_gltex;
   setup_gltex(gltex, tex->get_x_size(), tex->get_y_size());
   setup_gltex(gltex, tex->get_x_size(), tex->get_y_size());
 
 
-  PIXEL *ip = gltex->pixmap;
+  PIXEL *ip = gltex->pixmap + gltex->xsize * gltex->ysize;
   PIXEL *fo = _c->zb->pbuf + xo + yo * _c->zb->linesize / PSZB;
   PIXEL *fo = _c->zb->pbuf + xo + yo * _c->zb->linesize / PSZB;
   for (int y = 0; y < gltex->ysize; ++y) {
   for (int y = 0; y < gltex->ysize; ++y) {
+    ip -= gltex->xsize;
     memcpy(ip, fo, gltex->xsize * PSZB);
     memcpy(ip, fo, gltex->xsize * PSZB);
-    ip += gltex->xsize;
     fo += _c->zb->linesize / PSZB;
     fo += _c->zb->linesize / PSZB;
   }
   }
 
 

+ 1 - 1
panda/src/tinydisplay/tinyXGraphicsWindow.cxx

@@ -574,7 +574,7 @@ void TinyXGraphicsWindow::
 close_window() {
 close_window() {
   if (_gsg != (GraphicsStateGuardian *)NULL) {
   if (_gsg != (GraphicsStateGuardian *)NULL) {
     TinyGraphicsStateGuardian *tinygsg;
     TinyGraphicsStateGuardian *tinygsg;
-    DCAST_INTO_R(tinygsg, _gsg, false);
+    DCAST_INTO_V(tinygsg, _gsg);
     tinygsg->_current_frame_buffer = NULL;
     tinygsg->_current_frame_buffer = NULL;
     _gsg.clear();
     _gsg.clear();
     _active = false;
     _active = false;