diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2009-08-25 01:06:55 +0400 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2009-08-25 01:06:55 +0400 |
commit | 8b51b993dbbfe7b1dd092f3d553ccc5b1ac6172a (patch) | |
tree | 7f481f141132e28b2a34326a230fce46d7ef88b8 | |
parent | 8eeb71e6d9eabe99ee774140481b3ad073c46767 (diff) |
Smoke:
* Bugfix for scaling on non-2^n-textures
-rw-r--r-- | source/blender/editors/space_view3d/drawvolume.c | 10 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_extensions.c | 19 |
2 files changed, 12 insertions, 17 deletions
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 53f193382bd..237ffe71ddb 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -197,7 +197,6 @@ void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture RegionView3D *rv3d= ar->regiondata; float viewnormal[3]; - // int res[3]; int i, j, n; float d, d0, dd; float *points = NULL; @@ -237,9 +236,12 @@ void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture GPU_texture_bind(tex, 0); - cor[0] = (float)res[0]/(float)larger_pow2(res[0]); - cor[1] = (float)res[1]/(float)larger_pow2(res[1]); - cor[2] = (float)res[2]/(float)larger_pow2(res[2]); + // if (!GLEW_ARB_texture_non_power_of_two) + { + cor[0] = (float)res[0]/(float)larger_pow2(res[0]); + cor[1] = (float)res[1]/(float)larger_pow2(res[1]); + cor[2] = (float)res[2]/(float)larger_pow2(res[2]); + } // our slices are defined by the plane equation a*x + b*y +c*z + d = 0 // (a,b,c), the plane normal, are given by viewdir diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 0b6640b9e27..9e53c85a5ba 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -326,6 +326,7 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels) tex->number = -1; tex->refcount = 1; tex->target = GL_TEXTURE_3D; + float vfBorderColor[4] = {0.0f, 0.0f, 0.0f, 0.0f}; glGenTextures(1, &tex->bindcode); @@ -336,7 +337,7 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels) return NULL; } - // if (!GLEW_ARB_texture_non_power_of_two) + if (!GLEW_ARB_texture_non_power_of_two) { tex->w = larger_pow2(tex->w); tex->h = larger_pow2(tex->h); @@ -357,22 +358,14 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels) if (fpixels) { glTexSubImage3D(tex->target, 0, 0, 0, 0, w, h, depth, format, type, pixels); - - /* - if (tex->w > w) - GPU_glTexSubImageEmpty(tex->target, format, w, 0, tex->w-w, tex->h); - if (tex->h > h) - GPU_glTexSubImageEmpty(tex->target, format, 0, h, w, tex->h-h); - */ } - // glTexImage3D(tex->target, 0, GL_RGBA, w, h, depth, 0, GL_RGBA, GL_FLOAT, fpixels); - + // glTexParameterfv(GL_TEXTURE_3D, GL_TEXTURE_BORDER_COLOR, vfBorderColor); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_BORDER); - glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_BORDER); - glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R,GL_CLAMP_TO_BORDER); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER); if (pixels) |