[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49669] branches/soc-2012-swiss_cheese/ source/blender: Converted all glMatrix calls to gpuMatrix

Alexander Kuznetsov kuzsasha at gmail.com
Tue Aug 7 18:59:40 CEST 2012


Revision: 49669
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49669
Author:   alexk
Date:     2012-08-07 16:59:39 +0000 (Tue, 07 Aug 2012)
Log Message:
-----------
Converted all glMatrix calls to gpuMatrix
gpuMatrixCommit occurs right before glDraw* (mainly in gpu_immediate and few other places)

Modified Paths:
--------------
    branches/soc-2012-swiss_cheese/source/blender/blenfont/intern/blf.c
    branches/soc-2012-swiss_cheese/source/blender/blenkernel/intern/cdderivedmesh.c
    branches/soc-2012-swiss_cheese/source/blender/editors/animation/anim_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/animation/anim_markers.c
    branches/soc-2012-swiss_cheese/source/blender/editors/animation/keyframes_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/armature/editarmature_sketch.c
    branches/soc-2012-swiss_cheese/source/blender/editors/include/BIF_gl.h
    branches/soc-2012-swiss_cheese/source/blender/editors/include/BIF_glutil.h
    branches/soc-2012-swiss_cheese/source/blender/editors/interface/interface.c
    branches/soc-2012-swiss_cheese/source/blender/editors/interface/interface_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/interface/interface_panel.c
    branches/soc-2012-swiss_cheese/source/blender/editors/interface/interface_widgets.c
    branches/soc-2012-swiss_cheese/source/blender/editors/interface/view2d.c
    branches/soc-2012-swiss_cheese/source/blender/editors/mesh/editmesh_knife.c
    branches/soc-2012-swiss_cheese/source/blender/editors/mesh/editmesh_loopcut.c
    branches/soc-2012-swiss_cheese/source/blender/editors/mesh/editmesh_slide.c
    branches/soc-2012-swiss_cheese/source/blender/editors/physics/particle_edit.c
    branches/soc-2012-swiss_cheese/source/blender/editors/screen/area.c
    branches/soc-2012-swiss_cheese/source/blender/editors/screen/glutil.c
    branches/soc-2012-swiss_cheese/source/blender/editors/sculpt_paint/paint_cursor.c
    branches/soc-2012-swiss_cheese/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2012-swiss_cheese/source/blender/editors/sculpt_paint/paint_utils.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_clip/clip_dopesheet_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_clip/clip_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_clip/clip_graph_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_clip/clip_utils.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_clip/space_clip.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_graph/graph_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_image/image_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_node/drawnode.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_sequencer/sequencer_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_text/text_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_time/space_time.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_view3d/drawanimviz.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_view3d/drawarmature.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_view3d/drawmesh.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_view3d/drawvolume.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_view3d/space_view3d.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_view3d/view3d_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_view3d/view3d_edit.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_view3d/view3d_select.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_view3d/view3d_view.c
    branches/soc-2012-swiss_cheese/source/blender/editors/transform/transform.c
    branches/soc-2012-swiss_cheese/source/blender/editors/transform/transform_constraints.c
    branches/soc-2012-swiss_cheese/source/blender/editors/transform/transform_manipulator.c
    branches/soc-2012-swiss_cheese/source/blender/editors/transform/transform_snap.c
    branches/soc-2012-swiss_cheese/source/blender/editors/uvedit/uvedit_draw.c
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_buffers.c
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_draw.c
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_extensions.c
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_immediate_gl11.c
    branches/soc-2012-swiss_cheese/source/blender/windowmanager/intern/wm_operators.c
    branches/soc-2012-swiss_cheese/source/blender/windowmanager/intern/wm_subwindow.c

Modified: branches/soc-2012-swiss_cheese/source/blender/blenfont/intern/blf.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/blenfont/intern/blf.c	2012-08-07 16:55:15 UTC (rev 49668)
+++ branches/soc-2012-swiss_cheese/source/blender/blenfont/intern/blf.c	2012-08-07 16:59:39 UTC (rev 49669)
@@ -555,8 +555,6 @@
 	}
 #endif
 
-	gpuMatrixLock();
-
 	gpuMatrixMode(GL_TEXTURE);
 	gpuPushMatrix();
 	gpuLoadIdentity();
@@ -575,7 +573,7 @@
 		gpuScale(font->aspect[0], font->aspect[1], font->aspect[2]);
 
 	if (font->flags & BLF_ROTATION)
-		gpuRotateAxis(font->angle, 'Z');
+		gpuRotateAxis(font->angle*M_PI/180.0f, 'Z');
 
 	if (font->shadow || font->blur) 
 		gpuGetCurrentColor4fv(font->orig_col);
@@ -598,8 +596,6 @@
 	gpuMatrixMode(GL_MODELVIEW);
 	gpuPopMatrix();
 
-	gpuMatrixUnlock();
-
 	/* XXX: current color becomes undefined due to use of vertex arrays,
 	        but a lot of code relies on it remaining the same */
 	if (font->shadow || font->blur) 

Modified: branches/soc-2012-swiss_cheese/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/blenkernel/intern/cdderivedmesh.c	2012-08-07 16:55:15 UTC (rev 49668)
+++ branches/soc-2012-swiss_cheese/source/blender/blenkernel/intern/cdderivedmesh.c	2012-08-07 16:59:39 UTC (rev 49669)
@@ -328,6 +328,7 @@
 	}
 	else {  /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
 		GPU_vertex_setup(dm);
+		gpuMatrixCommit();
 		if (!GPU_buffer_legacy(dm)) {
 			if (dm->drawObject->tot_triangle_point)
 				glDrawArrays(GL_POINTS, 0, dm->drawObject->tot_triangle_point);
@@ -378,6 +379,7 @@
 			int curpos = 0;
 
 			GPU_uvedge_setup(dm);
+			gpuMatrixCommit();
 			if (!GPU_buffer_legacy(dm)) {
 				for (i = 0; i < dm->numTessFaceData; i++, mf++) {
 					if (!(mf->flag & ME_HIDE)) {
@@ -800,7 +802,7 @@
 							GPU_color_switch(1);
 						else
 							GPU_color_switch(0);
-
+						gpuMatrixCommit();
 						glDrawArrays(GL_TRIANGLES, first, count);
 					}
 
@@ -964,6 +966,7 @@
 			}
 			if (setDrawOptions == NULL) {
 				/* just draw the entire face array */
+				gpuMatrixCommit();
 				glDrawArrays(GL_TRIANGLES, 0, (tottri) * 3);
 			}
 			else {
@@ -1008,7 +1011,10 @@
 						int count = (i - prevstart + (draw_option != DM_DRAW_OPTION_SKIP ? 1 : 0)) * 3;
 
 						if (count)
+						{
+							gpuMatrixCommit();
 							glDrawArrays(GL_TRIANGLES, first, count);
+						}
 
 						prevstart = i + 1;
 					}
@@ -1262,6 +1268,7 @@
 		GPU_normal_setup(dm);
 
 		if (!GPU_buffer_legacy(dm)) {
+			gpuMatrixCommit();
 			for (i = 0; i < dm->drawObject->tot_triangle_point / 3; i++) {
 
 				a = dm->drawObject->triangle_to_mface[i];
@@ -1441,6 +1448,7 @@
 						GPU_buffer_unlock(buffer);
 						GPU_interleaved_attrib_setup(buffer, datatypes, numdata);
 					}
+					gpuMatrixCommit();
 					glDrawArrays(GL_TRIANGLES, start * 3, (curface - start) * 3);
 				}
 			}

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/animation/anim_draw.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/animation/anim_draw.c	2012-08-07 16:55:15 UTC (rev 49668)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/animation/anim_draw.c	2012-08-07 16:59:39 UTC (rev 49669)
@@ -186,7 +186,7 @@
 	
 	/* because the frame number text is subject to the same scaling as the contents of the view */
 	UI_view2d_getscale(v2d, &xscale, &yscale);
-	glScalef(1.0f / xscale, 1.0f, 1.0f);
+	gpuScale(1.0f / xscale, 1.0f, 1.0f);
 	
 	/* get timecode string 
 	 *	- padding on str-buf passed so that it doesn't sit on the frame indicator
@@ -212,7 +212,7 @@
 	UI_DrawString(x - 5, y + 3, numstr);
 	
 	/* restore view transform */
-	glScalef(xscale, 1.0, 1.0);
+	gpuScale(xscale, 1.0, 1.0);
 }
 
 /* General call for drawing current frame indicator in animation editor */

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/animation/anim_markers.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/animation/anim_markers.c	2012-08-07 16:55:15 UTC (rev 49668)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/animation/anim_markers.c	2012-08-07 16:59:39 UTC (rev 49669)
@@ -359,7 +359,7 @@
 	ypixels = v2d->mask.ymax - v2d->mask.ymin;
 	UI_view2d_getscale(v2d, &xscale, &yscale);
 	
-	glScalef(1.0f / xscale, 1.0f, 1.0f);
+	gpuScale(1.0f / xscale, 1.0f, 1.0f);
 	
 	glEnable(GL_BLEND);
 	
@@ -431,7 +431,7 @@
 		UI_DrawString(x, y, marker->name); // DOODLE text label
 	}
 	
-	glScalef(xscale, 1.0f, 1.0f);
+	gpuScale(xscale, 1.0f, 1.0f);
 }
 
 /* Draw Scene-Markers in time window */

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/animation/keyframes_draw.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/animation/keyframes_draw.c	2012-08-07 16:55:15 UTC (rev 49668)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/animation/keyframes_draw.c	2012-08-07 16:59:39 UTC (rev 49669)
@@ -588,8 +588,8 @@
 	hsize -= 0.5f * key_type;
 	
 	/* adjust view transform before starting */
-	glTranslatef(x, y, 0.0f);
-	glScalef(1.0f / xscale * hsize, hsize, 1.0f);
+	gpuTranslate(x, y, 0.0f);
+	gpuScale(1.0f / xscale * hsize, hsize, 1.0f);
 	
 	/* anti-aliased lines for more consistent appearance */
 	glEnable(GL_LINE_SMOOTH);
@@ -641,8 +641,8 @@
 	glDisable(GL_LINE_SMOOTH);
 	
 	/* restore view transform */
-	glScalef(xscale / hsize, 1.0f / hsize, 1.0f);
-	glTranslatef(-x, -y, 0.0f);
+	gpuScale(xscale / hsize, 1.0f / hsize, 1.0f);
+	gpuTranslate(-x, -y, 0.0f);
 }
 
 static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, float ypos, short channelLocked)

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/armature/editarmature_sketch.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/armature/editarmature_sketch.c	2012-08-07 16:55:15 UTC (rev 49668)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/armature/editarmature_sketch.c	2012-08-07 16:59:39 UTC (rev 49669)
@@ -455,7 +455,7 @@
 
 static void sk_drawPoint(GPUprim3 *prim, SK_Point *pt, float size)
 {
-	glTranslatef(pt->p[0], pt->p[1], pt->p[2]);
+	gpuTranslate(pt->p[0], pt->p[1], pt->p[2]);
 
 	gpuDrawSphere(prim, sk_clampPointSize(pt, size));
 	//GLU Sphere(quad, sk_clampPointSize(pt, size), 8, 8);
@@ -476,7 +476,7 @@
 
 	angle = angle_normalized_v3v3(vec2, vec1);
 
-	glRotatef(angle * (float)(180.0 / M_PI) + 180.0f, axis[0], axis[1], axis[2]);
+	gpuRotateVector(angle + M_PI, axis);
 
 	gpuDrawCylinder(prim, sk_clampPointSize(pt1, size), sk_clampPointSize(pt0, size), length);
 	//GLU Cylinder(quad, sk_clampPointSize(pt1, size), sk_clampPointSize(pt0, size), length, 8, 8);
@@ -487,7 +487,7 @@
 	float vec2[3] = {0, 0, 1}, axis[3];
 	float angle;
 	
-	glPushMatrix();
+	gpuPushMatrix();
 
 	cross_v3_v3v3(axis, vec2, pt->no);
 
@@ -497,14 +497,14 @@
 
 	angle = angle_normalized_v3v3(vec2, pt->no);
 
-	glRotatef(angle * (float)(180.0 / M_PI), axis[0], axis[1], axis[2]);
+	gpuRotateVector(angle, axis);
 
 	gpuCurrentColor3x(CPACK_CYAN);
 
 	gpuDrawCylinder(prim, sk_clampPointSize(pt, size), 0, sk_clampPointSize(pt, height));
 	//GLU Cylinder(quad, sk_clampPointSize(pt, size), 0, sk_clampPointSize(pt, height), 10, 2);
 
-	glPopMatrix();
+	gpuPopMatrix();
 }
 
 static void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int end)
@@ -517,7 +517,7 @@
 		glLoadName(id);
 
 		for (i = 0; i < stk->nb_points; i++) {
-			glPushMatrix();
+			gpuPushMatrix();
 
 			sk_drawPoint(&prim, stk->points + i, 0.1);
 
@@ -525,7 +525,7 @@
 				sk_drawEdge(&prim, stk->points + i - 1, stk->points + i, 0.1);
 			}
 
-			glPopMatrix();
+			gpuPopMatrix();
 		}
 
 	}
@@ -539,7 +539,7 @@
 		for (i = 0; i < stk->nb_points; i++) {
 			SK_Point *pt = stk->points + i;
 
-			glPushMatrix();
+			gpuPushMatrix();
 
 			if (pt->type == PT_EXACT) {
 				gpuCurrentColor3x(CPACK_BLACK);
@@ -563,7 +563,7 @@
 				sk_drawEdge(&prim, pt - 1, pt, 0.1);
 			}
 
-			glPopMatrix();
+			gpuPopMatrix();
 
 			add_v3_v3(rgb, d_rgb);
 		}
@@ -586,14 +586,14 @@
 	while (index != -1) {
 		SK_Point *pt = stk->points + index;
 
-		glPushMatrix();
+		gpuPushMatrix();
 
 		gpuCurrentColor3x(CPACK_GREEN);
 		sk_drawPoint(&prim, pt, 0.15);
 
 		sk_drawNormal(&prim, pt, 0.05, 0.9);
 
-		glPopMatrix();
+		gpuPopMatrix();
 
 		copy_v3_v3(head, tail);
 		bone_start = index; // start next bone from current index
@@ -2070,7 +2070,7 @@
 			if (last != NULL) {
 				GPUprim3 prim = GPU_PRIM_LOFI_SOLID;
 
-				glPushMatrix();
+				gpuPushMatrix();
 
 				glEnable(GL_BLEND);
 
@@ -2091,7 +2091,7 @@
 
 				glDisable(GL_BLEND);
 
-				glPopMatrix();
+				gpuPopMatrix();
 			}
 		}
 	}
@@ -2120,8 +2120,8 @@
 			index = (index >> 5) & 7;
 
 			gpuCurrentColor3fv(colors[index]);
-			glPushMatrix();
-			glTranslatef(p->p[0], p->p[1], p->p[2]);
+			gpuPushMatrix();
+			gpuTranslate(p->p[0], p->p[1], p->p[2]);
 
 			if (!dl) {
 				gpuPushImmediate();
@@ -2133,7 +2133,7 @@
 				gpuImmediateSingleRepeat(dl);
 			}
 
-			glPopMatrix();
+			gpuPopMatrix();
 		}
 	}
 #endif

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/include/BIF_gl.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/include/BIF_gl.h	2012-08-07 16:55:15 UTC (rev 49668)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/include/BIF_gl.h	2012-08-07 16:59:39 UTC (rev 49669)
@@ -35,13 +35,7 @@
 
 #include <GL/glew.h>
 
-#ifdef GLES
-#define glMultMatrixf(x)  fake_glMultMatrixf( (float *)(x))
-#define glLoadMatrixf(x)  fake_glLoadMatrixf( (float *)(x))
-#else
-#define glMultMatrixf(x)  glMultMatrixf( (float *)(x))
-#define glLoadMatrixf(x)  glLoadMatrixf( (float *)(x))
-#endif
 
+
 #endif /* #ifdef __BIF_GL_H__ */
 

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/include/BIF_glutil.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/include/BIF_glutil.h	2012-08-07 16:55:15 UTC (rev 49668)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/include/BIF_glutil.h	2012-08-07 16:59:39 UTC (rev 49669)
@@ -171,8 +171,8 @@
 
 /* For caching opengl matrices (gluProject/gluUnProject) */

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list