Fix #19875: drawing smoke on graphics cards that do not support

non-power-of-two textures lead to artifacts due to uninitialized
memory if the domain had a non-power-of-two size.
This commit is contained in:
Brecht Van Lommel 2010-01-30 09:24:50 +00:00
parent 36b5cd008d
commit 2b352211f4

@ -372,6 +372,13 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
GPU_print_error("3D glTexImage3D");
if (fpixels) {
if(!GPU_non_power_of_two_support() && (w != tex->w || h != tex->h || depth != tex->depth)) {
/* clear first to avoid unitialized pixels */
float *zero= MEM_callocN(sizeof(float)*tex->w*tex->h*tex->depth, "zero");
glTexSubImage3D(tex->target, 0, 0, 0, 0, tex->w, tex->h, tex->depth, format, type, zero);
MEM_freeN(zero);
}
glTexSubImage3D(tex->target, 0, 0, 0, 0, w, h, depth, format, type, fpixels);
GPU_print_error("3D glTexSubImage3D");
}