Commit: d2b4f9c627e6a9621797d7b9b8b3b83d3bfc2db5
Author: Mike Erwin
Date:   Sat Dec 26 22:23:12 2015 -0500
Branches: master
https://developer.blender.org/rBd2b4f9c627e6a9621797d7b9b8b3b83d3bfc2db5

OpenGL: image drawing tweaks

- no need to allocate client memory up front
- delete unneeded GL calls
- set default alpha test function on exit

===================================================================

M       source/blender/editors/screen/glutil.c
M       source/blender/editors/space_view3d/drawobject.c

===================================================================

diff --git a/source/blender/editors/screen/glutil.c 
b/source/blender/editors/screen/glutil.c
index cbb6b76..44ccf9a 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -351,8 +351,6 @@ static int get_cached_work_texture(int *r_w, int *r_h)
        static int tex_h = 256;
 
        if (texid == -1) {
-               unsigned char *tbuf;
-
                glGenTextures(1, (GLuint *)&texid);
 
                glBindTexture(GL_TEXTURE_2D, texid);
@@ -360,9 +358,7 @@ static int get_cached_work_texture(int *r_w, int *r_h)
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 
GL_LINEAR);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 
GL_LINEAR);
 
-               tbuf = MEM_callocN(tex_w * tex_h * 4, "tbuf");
-               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, tex_w, tex_h, 0, 
GL_RGBA, GL_UNSIGNED_BYTE, tbuf);
-               MEM_freeN(tbuf);
+               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, tex_w, tex_h, 0, 
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 
                glBindTexture(GL_TEXTURE_2D, 0);
        }
diff --git a/source/blender/editors/space_view3d/drawobject.c 
b/source/blender/editors/space_view3d/drawobject.c
index 41b22f4..f3a3472 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -663,13 +663,12 @@ static void draw_empty_image(Object *ob, const short 
dflag, const unsigned char
 
                /* Draw the Image on the screen */
                glaDrawPixelsTex(ofs_x, ofs_y, ima_x, ima_y, GL_RGBA, 
GL_UNSIGNED_BYTE, zoomfilter, ibuf->rect);
-               glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
 
                glDisable(GL_BLEND);
 
                if (use_clip) {
                        glDisable(GL_ALPHA_TEST);
-                       glAlphaFunc(GL_GREATER, 0.0f);
+                       glAlphaFunc(GL_ALWAYS, 0.0f);
                }
        }
 
@@ -686,7 +685,6 @@ static void draw_empty_image(Object *ob, const short dflag, 
const unsigned char
        glEnd();
 
        /* Reset GL settings */
-       glMatrixMode(GL_MODELVIEW);
        glPopMatrix();
 
        BKE_image_release_ibuf(ima, ibuf, NULL);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to