[Bf-blender-cvs] [f10219a9772] blender2.8: Immediate Mode: handle other cases of glPop/glPushClientAttrib

Dalai Felinto noreply at git.blender.org
Tue Apr 4 18:43:14 CEST 2017


Commit: f10219a9772c948ecddfa486ba591952d3caafdc
Author: Dalai Felinto
Date:   Tue Apr 4 18:38:26 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBf10219a9772c948ecddfa486ba591952d3caafdc

Immediate Mode: handle other cases of glPop/glPushClientAttrib

Those cases were not using ClientAttrib but they should :)
Rather use a OpenGL3.3 alternative anyways.

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

M	source/blender/editors/screen/glutil.c
M	source/blender/windowmanager/intern/wm_gesture.c

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

diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 3108f965075..5a011db6090 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -411,6 +411,9 @@ void immDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h,
 	const bool use_clipping = ((clip_min_x < clip_max_x) && (clip_min_y < clip_max_y));
 	float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
 
+	GLint unpack_row_length;
+	glGetIntegerv(GL_UNPACK_ROW_LENGTH, &unpack_row_length);
+
 	glPixelStorei(GL_UNPACK_ROW_LENGTH, img_w);
 	glBindTexture(GL_TEXTURE_2D, texid);
 
@@ -546,7 +549,7 @@ void immDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h,
 	immUnbindProgram();
 
 	glBindTexture(GL_TEXTURE_2D, 0);
-	glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+	glPixelStorei(GL_UNPACK_ROW_LENGTH, unpack_row_length);
 }
 
 void immDrawPixelsTexScaled(float x, float y, int img_w, int img_h,
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 30867a2bba4..d49c83fa729 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -369,6 +369,9 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt)
 		glEnable(GL_BLEND);
 		glBlendFunc(GL_ONE, GL_ONE);
 
+		GLint unpack_alignment;
+		glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpack_alignment);
+
 		glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
 
 		GPUShader *shader = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
@@ -379,7 +382,7 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt)
 
 		GPU_shader_unbind();
 
-		glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+		glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment);
 
 		MEM_freeN(pixel_buf);




More information about the Bf-blender-cvs mailing list