Revision: 29557
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29557
Author:   jwilkins
Date:     2010-06-19 08:49:59 +0200 (Sat, 19 Jun 2010)

Log Message:
-----------
* Bug Fix: OpenGL state is now preserved after drawing the on-surface brush 
cursor.  This should fix problems with the rest of the UI drawing properly with 
it enabled.

Modified Paths:
--------------
    
branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c

Modified: 
branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- 
branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c   
    2010-06-19 06:26:07 UTC (rev 29556)
+++ 
branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c   
    2010-06-19 06:49:59 UTC (rev 29557)
@@ -520,6 +520,18 @@
 
                        alpha = (paint->flags & PAINT_SHOW_BRUSH_ON_SURFACE) ? 
min_alpha + (visual_strength*(max_alpha-min_alpha)) : 0.50f;
 
+                       glPushAttrib(
+                               GL_COLOR_BUFFER_BIT|
+                               GL_CURRENT_BIT|
+                               GL_DEPTH_BUFFER_BIT|
+                               GL_ENABLE_BIT|
+                               GL_LINE_BIT|
+                               GL_POLYGON_BIT|
+                               GL_STENCIL_BUFFER_BIT|
+                               GL_TRANSFORM_BIT|
+                               GL_VIEWPORT_BIT|
+                               GL_TEXTURE_BIT);
+
                        glColor4f(col[0], col[1], col[2], alpha);
 
                        glEnable(GL_BLEND);
@@ -586,18 +598,11 @@
 
                                gluDeleteQuadric(sphere);
 
-                               glDepthMask(GL_TRUE);
-
-                               glDisable(GL_DEPTH_TEST);
-
-                               glEnable(GL_CULL_FACE);
-
-                               glDisable(GL_STENCIL_TEST);
-
                                glPopMatrix();
 
                                glMatrixMode(GL_MODELVIEW);
                                glPopMatrix();
+
                        }
                        else {
                                glEnable(GL_LINE_SMOOTH);
@@ -618,11 +623,7 @@
 
                        if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_TILED 
&& brush->flag & BRUSH_TEXTURE_OVERLAY) {
                                const float diameter = 2*brush->size;
-                               //float inv_scale_x , inv_scale_y;
-                               //int procedural;
 
-                               //load_grid(brush);
-                               //procedural = load_tex(brush, &vc);
                                load_tex(brush, &vc);
 
                                glEnable(GL_TEXTURE_2D);
@@ -635,22 +636,6 @@
                                glMatrixMode(GL_TEXTURE);
                                glLoadIdentity();
 
-                               //if (!procedural) {
-                               //      glTranslatef(0.5f, 0.5f, 0);
-                               //      glTranslatef(-brush->texture_center_x, 
-brush->texture_center_y, 0);
-
-                               //      inv_scale_x = 10000.0f / 
(brush->texture_scale_x*brush->texture_scale_percentage);
-                               //      inv_scale_y = 10000.0f / 
(brush->texture_scale_y*brush->texture_scale_percentage);
-
-                               //      glScalef(inv_scale_x, inv_scale_y, 0);
-
-                               //      glRotatef(-brush->mtex.rot * 
180.0f/M_PI, 0, 0, 1);
-
-                               //      glScalef(viewport[2] / diameter, 
viewport[3] / diameter, 0);
-
-                               //      glTranslatef(-0.5f, -0.5f, 0);
-                               //}
-
                                glColor4f(1.0f, 1.0f, 1.0f, 
brush->texture_overlay_alpha / 100.0f);
                                glBegin(GL_QUADS);
                                        glTexCoord2f(0, 0);
@@ -679,6 +664,8 @@
                        }
 
                        glDisable(GL_BLEND);
+
+                       glPopAttrib();
                }
        }
        else {


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

Reply via email to