[Bf-blender-cvs] [fb7977a] temp_manipulators_core: Remove any remaining OpenGL calls

Julian Eisel noreply at git.blender.org
Thu Oct 6 21:35:22 CEST 2016


Commit: fb7977a2f384d87db4b2a184057614e00a37a21d
Author: Julian Eisel
Date:   Thu Oct 6 20:29:02 2016 +0200
Branches: temp_manipulators_core
https://developer.blender.org/rBfb7977a2f384d87db4b2a184057614e00a37a21d

Remove any remaining OpenGL calls

This branch is likely going to be merged into blender2.8 branch soon so I rather avoid any OpenGL code that might need to be rewritten later.

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

M	source/blender/windowmanager/manipulators/intern/wm_manipulator.c
M	source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
M	source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c

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

diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
index cded4f0..6cbbcf7 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
@@ -50,58 +50,6 @@
 #include "wm_manipulator_wmapi.h"
 #include "wm_manipulator_intern.h"
 
-/**
- * Main draw call for ManipulatorGeometryInfo data
- */
-void wm_manipulator_geometryinfo_draw(ManipulatorGeometryInfo *info, const bool select)
-{
-	GLuint buf[3];
-
-	const bool use_lighting = !select && ((U.manipulator_flag & V3D_SHADED_MANIPULATORS) != 0);
-
-	if (use_lighting)
-		glGenBuffers(3, buf);
-	else
-		glGenBuffers(2, buf);
-
-	glEnableClientState(GL_VERTEX_ARRAY);
-	glBindBuffer(GL_ARRAY_BUFFER, buf[0]);
-	glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 3 * info->nverts, info->verts, GL_STATIC_DRAW);
-	glVertexPointer(3, GL_FLOAT, 0, NULL);
-
-	if (use_lighting) {
-		glEnableClientState(GL_NORMAL_ARRAY);
-		glBindBuffer(GL_ARRAY_BUFFER, buf[2]);
-		glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 3 * info->nverts, info->normals, GL_STATIC_DRAW);
-		glNormalPointer(GL_FLOAT, 0, NULL);
-		glShadeModel(GL_SMOOTH);
-	}
-
-	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buf[1]);
-	glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(unsigned short) * (3 * info->ntris), info->indices, GL_STATIC_DRAW);
-
-	glEnable(GL_CULL_FACE);
-	glEnable(GL_DEPTH_TEST);
-
-	glDrawElements(GL_TRIANGLES, info->ntris * 3, GL_UNSIGNED_SHORT, NULL);
-
-	glDisable(GL_DEPTH_TEST);
-	glDisable(GL_CULL_FACE);
-
-	glBindBuffer(GL_ARRAY_BUFFER, 0);
-	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
-
-	glDisableClientState(GL_VERTEX_ARRAY);
-
-	if (use_lighting) {
-		glDisableClientState(GL_NORMAL_ARRAY);
-		glShadeModel(GL_FLAT);
-		glDeleteBuffers(3, buf);
-	}
-	else {
-		glDeleteBuffers(2, buf);
-	}
-}
 
 /* Still unused */
 wmManipulator *WM_manipulator_new(
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h b/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
index 386c8bb..1a9693a 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
@@ -226,7 +226,5 @@ typedef struct ManipulatorGeometryInfo {
 	bool init;
 } ManipulatorGeometryInfo;
 
-void wm_manipulator_geometryinfo_draw(ManipulatorGeometryInfo *info, const bool select);
-
 #endif  /* __WM_MANIPULATOR_INTERN_H__ */
 
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c b/source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
index 1bffafe..20f2df1 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
@@ -237,30 +237,6 @@ static void manipulators_draw_list(const wmManipulatorMap *mmap, const bContext
 		return;
 	BLI_assert(!BLI_listbase_is_empty(&mmap->manipulator_groups));
 
-	const bool draw_multisample = (U.ogl_multisamples != USER_MULTISAMPLE_NONE);
-	const bool use_lighting = (U.manipulator_flag & V3D_SHADED_MANIPULATORS) != 0;
-
-	/* enable multisampling */
-	if (draw_multisample) {
-		glEnable(GL_MULTISAMPLE);
-	}
-	if (use_lighting) {
-		const float lightpos[4] = {0.0, 0.0, 1.0, 0.0};
-		const float diffuse[4] = {1.0, 1.0, 1.0, 0.0};
-
-		glPushAttrib(GL_LIGHTING_BIT | GL_ENABLE_BIT);
-
-		glEnable(GL_LIGHTING);
-		glEnable(GL_LIGHT0);
-		glEnable(GL_COLOR_MATERIAL);
-		glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
-		glPushMatrix();
-		glLoadIdentity();
-		glLightfv(GL_LIGHT0, GL_POSITION, lightpos);
-		glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
-		glPopMatrix();
-	}
-
 	/* draw_manipulators contains all visible manipulators - draw them */
 	for (LinkData *link = draw_manipulators->first, *link_next; link; link = link_next) {
 		wmManipulator *manipulator = link->data;
@@ -270,13 +246,6 @@ static void manipulators_draw_list(const wmManipulatorMap *mmap, const bContext
 		/* free/remove manipulator link after drawing */
 		BLI_freelinkN(draw_manipulators, link);
 	}
-
-	if (draw_multisample) {
-		glDisable(GL_MULTISAMPLE);
-	}
-	if (use_lighting) {
-		glPopAttrib();
-	}
 }
 
 void WM_manipulatormap_draw(wmManipulatorMap *mmap, const bContext *C, const int drawstep)




More information about the Bf-blender-cvs mailing list