Hi,
I just spent some time investigating an OpenGL driver bug that's been
around on OS X for a while. I was hoping it would be fixed in 10.6 but
apparently it's not (reports in tracker [1]).
The bug affects anything using glTexSubImage2D(), notably in blender
things like node previews or 3D background images that use
glaDrawPixelsTex(). According to a report I found [2], glTexSubImage2D
is being improperly affected by glPixelZoom, where it shouldn't be.
This makes it transfer the wrong amount of pixels.
Here's how the bug looks on my macbook pro, 10.5:
http://mke3.net/blender/devel/2.5/apple_glbug.mov
It makes node previews and background images basically unusable.
to workaround, I just force glPixelZoom(1.0, 1.0) before the
glTexSubImage2D calls and restore it after. This seems to work fine:
http://mke3.net/blender/devel/2.5/apple_glbug_workaround.mov
So, any openGL gurus: is this ok to apply? According to that link, the
bug has been logged with apple, but it's been over a year already, and
nothing's been done, so I'd really like to have some workaround to at
least make this aspect of Blender usable on os x.
cheers,
Matt
[1]
http://projects.blender.org/tracker/index.php?func=detail&aid=20034&group_id=9&atid=498
[2] http://lists.apple.com/archives/Mac-opengl/2008/Jul/msg00117.html
Index: source/blender/editors/screen/glutil.c
===================================================================
--- source/blender/editors/screen/glutil.c (revision 24895)
+++ source/blender/editors/screen/glutil.c (working copy)
@@ -443,6 +443,10 @@
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__
+ 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 +480,10 @@
glBindTexture(GL_TEXTURE_2D, ltexid);
glPixelStorei(GL_UNPACK_ROW_LENGTH, lrowlength);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+#ifdef __APPLE__
+ glPixelZoom(xzoom, yzoom);
+#endif
}
void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void
*rect)
_______________________________________________
Bf-committers mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-committers