diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-30 12:24:50 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-30 12:24:50 +0300 |
commit | 2b352211f48e033dd0af84b903c4c5a997c9320b (patch) | |
tree | 827ee76dfef0458ebb63f2715216d852176f683d /source/blender/gpu/intern/gpu_extensions.c | |
parent | 36b5cd008d8534c6b5db7b08f57884270871cf05 (diff) |
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.
Diffstat (limited to 'source/blender/gpu/intern/gpu_extensions.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_extensions.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 5deef4a5200..48ef5fdb0aa 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -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"); } |