diff options
author | Matt Ebb <matt@mke3.net> | 2009-11-26 05:11:07 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2009-11-26 05:11:07 +0300 |
commit | ca3a9f184f7d0597021994e7b8f244c518b52b82 (patch) | |
tree | def25c1cb126db51ba52a6c118e3b8a0713b45e3 /source/blender/editors/screen/glutil.c | |
parent | 6a30bc6816672b5d02dc538dddd5fd724daf91ad (diff) |
Fix for [#20034] Background Image Distortion while zooming and moving around 3D window.
This is working around an Apple OpenGL driver bug, chatted to Martin about this in IRC, seems ok. Hopefully can revert this if/when Apple comes up with a driver fix.
Diffstat (limited to 'source/blender/editors/screen/glutil.c')
-rw-r--r-- | source/blender/editors/screen/glutil.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 742fab07bcc..752c6feb9af 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -439,10 +439,15 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, glPixelStorei(GL_UNPACK_ROW_LENGTH, img_w); glBindTexture(GL_TEXTURE_2D, texid); - /* don't want nasty border artifacts */ - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + /* don't want nasty border artifacts */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); +#ifdef __APPLE__ + /* workaround for os x 10.5/10.6 driver bug: http://lists.apple.com/archives/Mac-opengl/2008/Jul/msg00117.html */ + glPixelZoom(1.f, 1.f); +#endif + for (subpart_y=0; subpart_y<nsubparts_y; subpart_y++) { for (subpart_x=0; subpart_x<nsubparts_x; subpart_x++) { int subpart_w= (subpart_x==nsubparts_x-1)?(img_w-subpart_x*tex_w):tex_w; @@ -476,6 +481,11 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, glBindTexture(GL_TEXTURE_2D, ltexid); glPixelStorei(GL_UNPACK_ROW_LENGTH, lrowlength); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + +#ifdef __APPLE__ + /* workaround for os x 10.5/10.6 driver bug (above) */ + glPixelZoom(xzoom, yzoom); +#endif } void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *rect) |