diff --git a/panda/src/glstuff/glGraphicsBuffer_src.cxx b/panda/src/glstuff/glGraphicsBuffer_src.cxx index bce6dff1b9..9cf2c09d36 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.cxx +++ b/panda/src/glstuff/glGraphicsBuffer_src.cxx @@ -178,7 +178,7 @@ rebuild_bitplanes() { } int bitplane_x = _x_size; int bitplane_y = _y_size; - if (!glgsg->get_supports_tex_non_pow2()) { + if (textures_power_2 != ATS_none) { bitplane_x = Texture::up_to_power_2(bitplane_x); bitplane_y = Texture::up_to_power_2(bitplane_y); } @@ -282,6 +282,7 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, GLenum atta // Bind the texture to the slot. tex->set_x_size(_rb_size_x); tex->set_y_size(_rb_size_y); + tex->set_pad_size(_rb_size_x - _x_size, _rb_size_y - _y_size); if (attachpoint == GL_DEPTH_ATTACHMENT_EXT) { tex->set_format(Texture::F_depth_stencil); TextureContext *tc = tex->prepare_now(glgsg->get_prepared_objects(), glgsg); diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 0635f658f6..2e1a7b2a85 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -7157,6 +7157,11 @@ upload_texture_image(CLP(TextureContext) *gtc, default: if (image_compression == Texture::CM_off) { + if (n==0) { + // It's unfortunate that we can't adjust the width, too, + // but TexSubImage2D doesn't accept a row-stride parameter. + height = tex->get_y_size() - tex->get_pad_y_size(); + } GLP(TexSubImage2D)(page_target, n - mipmap_bias, 0, 0, width, height, external_format, component_type, image_ptr); } else {