WM Draw Methods now has a new option Automatic (default). This will
[blender-staging.git] / source / blender / editors / screen / glutil.c
index 5312ca269061d3897409549341a183ac8fd96cd9..1ea0c2ccdbdc592df0726eab74fa58d1442c4c8f 100644 (file)
@@ -37,7 +37,7 @@
 #include "BKE_utildefines.h"
 #include "BKE_colortools.h"
 
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_threads.h"
 
 #include "BIF_gl.h"
@@ -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)
@@ -720,6 +730,18 @@ void bglBegin(int mode)
        }
 }
 
+int bglPointHack() {
+       float value[4];
+       int pointhack;
+       glGetFloatv(GL_POINT_SIZE_RANGE, value);
+       if(value[1]<2.0) {
+               glGetFloatv(GL_POINT_SIZE, value);
+               pointhack= floor(value[0]+0.5);
+               if(pointhack>4) pointhack= 4;
+               return pointhack;
+       }
+       return 0;
+}
 
 void bglVertex3fv(float *vec)
 {
@@ -829,22 +851,11 @@ void bglPolygonOffset(float viewdist, float dist)
        }
 }
 
-int is_a_really_crappy_intel_card(void)
-{
-       static int well_is_it= -1;
-
-               /* Do you understand the implication? Do you? */
-       if (well_is_it==-1)
-               well_is_it= (strcmp((char*) glGetString(GL_VENDOR), "Intel Inc.") == 0);
-
-       return well_is_it;
-}
-
 void bglFlush(void) 
 {
        glFlush();
 #ifdef __APPLE__
-//     if(is_a_really_crappy_intel_card())
+//     if(GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_OFFICIAL))
 // XXX         myswapbuffers(); //hack to get mac intel graphics to show frontbuffer
 #endif
 }