[Bf-blender-cvs] [a68cc0dc26b] blender2.8: OpenGL: use old API for texture matrix

Mike Erwin noreply at git.blender.org
Mon Mar 27 07:18:16 CEST 2017


Commit: a68cc0dc26bf55a9087375f8d104fcccd8571844
Author: Mike Erwin
Date:   Sun Mar 26 21:05:02 2017 -0400
Branches: blender2.8
https://developer.blender.org/rBa68cc0dc26bf55a9087375f8d104fcccd8571844

OpenGL: use old API for texture matrix

New matrix API does not support texture matrices. Not sure what the final code will look like, but this at least avoids interference with new ModelView matrix.

Marked each line with TEXTURE so they can be disregarded during searches.

Related to T49450

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

M	source/blender/editors/sculpt_paint/paint_cursor.c
M	source/blender/editors/space_view3d/drawmesh.c
M	source/blender/gpu/intern/gpu_draw.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index e90baf083d5..0e18bddc45f 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -606,20 +606,20 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
 		glDepthFunc(GL_ALWAYS);
 
 		glMatrixMode(GL_TEXTURE);
-		gpuPushMatrix();
-		gpuLoadIdentity();
+		glPushMatrix(); /* TEXTURE */
+		glLoadIdentity(); /* TEXTURE */
 
 		if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) {
 			/* brush rotation */
-			gpuTranslate2f(0.5, 0.5);
-			gpuRotate2D(RAD2DEGF(primary ? ups->brush_rotation : ups->brush_rotation_sec));
-			gpuTranslate2f(-0.5f, -0.5f);
+			glTranslatef(0.5, 0.5, 0); /* TEXTURE */
+			glRotatef(RAD2DEGF(primary ? ups->brush_rotation : ups->brush_rotation_sec), 0, 0, 1);  /* TEXTURE */
+			glTranslatef(-0.5f, -0.5f, 0); /* TEXTURE */
 
 			/* scale based on tablet pressure */
 			if (primary && ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush)) {
-				gpuTranslate2f(0.5f, 0.5f);
-				gpuScaleUniform(1.0f / ups->size_pressure_value);
-				gpuTranslate2f(-0.5f, -0.5f);
+				glTranslatef(0.5f, 0.5f, 0); /* TEXTURE */
+				glScalef(1.0f / ups->size_pressure_value, 1.0f / ups->size_pressure_value, 1.0f / ups->size_pressure_value); /* TEXTURE */
+				glTranslatef(-0.5f, -0.5f, 0); /* TEXTURE */
 			}
 
 			if (ups->draw_anchored) {
@@ -697,7 +697,7 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
 
 		immUnbindProgram();
 
-		gpuPopMatrix();
+		glPopMatrix(); /* TEXTURE */
 
 		if (mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL) {
 			glMatrixMode(GL_MODELVIEW);
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 102a754e6de..92fb8d3efa1 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -1104,7 +1104,7 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
 			glBindTexture(GL_TEXTURE_2D, ima->bindcode[TEXTARGET_TEXTURE_2D]);
 
 			glMatrixMode(GL_TEXTURE);
-			gpuLoadMatrix3D(texbase->tex_mapping.mat);
+			glLoadMatrixf((float*) texbase->tex_mapping.mat); /* TEXTURE */
 			glMatrixMode(GL_MODELVIEW);
 
 			/* use active UV texture layer */
@@ -1140,7 +1140,7 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
 	}
 	else {
 		glMatrixMode(GL_TEXTURE);
-		gpuLoadIdentity();
+		glLoadIdentity(); /* TEXTURE */
 		glMatrixMode(GL_MODELVIEW);
 
 		/* enable solid material */
@@ -1243,7 +1243,7 @@ void draw_mesh_textured(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D
 	glFrontFace(GL_CCW);
 
 	glMatrixMode(GL_TEXTURE);
-	gpuLoadIdentity();
+	glLoadIdentity(); /* TEXTURE */
 	glMatrixMode(GL_MODELVIEW);
 
 	/* faceselect mode drawing over textured mesh */
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 9e9cd4df9c2..f5d5af3f373 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -420,7 +420,7 @@ void GPU_clear_tpage(bool force)
 	GTS.curima = NULL;
 	if (GTS.curtilemode != 0) {
 		glMatrixMode(GL_TEXTURE);
-		gpuLoadIdentity();
+		glLoadIdentity(); /* TEXTURE */
 		glMatrixMode(GL_MODELVIEW);
 	}
 	GTS.curtilemode = 0;
@@ -604,10 +604,10 @@ int GPU_verify_image(
 	    GTS.curtileYRep != GTS.tileYRep)
 	{
 		glMatrixMode(GL_TEXTURE);
-		gpuLoadIdentity();
+		glLoadIdentity(); /* TEXTURE */
 
 		if (ima && (ima->tpageflag & IMA_TILES))
-			gpuScale2f(ima->xrep, ima->yrep);
+			glScalef(ima->xrep, ima->yrep, 0); /* TEXTURE */
 
 		glMatrixMode(GL_MODELVIEW);
 	}
@@ -2096,7 +2096,7 @@ void GPU_end_object_materials(void)
 	/* resetting the texture matrix after the scaling needed for tiled textures */
 	if (GTS.tilemode) {
 		glMatrixMode(GL_TEXTURE);
-		gpuLoadIdentity();
+		glLoadIdentity(); /* TEXTURE */
 		glMatrixMode(GL_MODELVIEW);
 	}
 }
@@ -2286,7 +2286,7 @@ void GPU_state_init(void)
 	glDepthRange(0.0, 1.0);
 
 	glMatrixMode(GL_TEXTURE);
-	gpuLoadIdentity();
+	glLoadIdentity(); /* TEXTURE */
 	glMatrixMode(GL_MODELVIEW);
 
 	glFrontFace(GL_CCW);




More information about the Bf-blender-cvs mailing list