Browse Source

Fix crash when unpacking aligned textures

tobspr 10 years ago
parent
commit
7d9b5d61f9
1 changed files with 4 additions and 0 deletions
  1. 4 0
      panda/src/glstuff/glGraphicsStateGuardian_src.cxx

+ 4 - 0
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -12113,6 +12113,10 @@ extract_texture_image(PTA_uchar &image, size_t &page_size,
     return false;
 #else
 
+  // Make sure the GL driver does not align textures, otherwise we get corrupt
+  // memory, since we don't take alignment into account.
+  glPixelStorei(GL_PACK_ALIGNMENT, 1);
+
   if (target == GL_TEXTURE_CUBE_MAP) {
     // A cube map, compressed or uncompressed.  This we must extract
     // one page at a time.