← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 4095: Move many Gl1_* into Gl1_Primitives.

 

------------------------------------------------------------
revno: 4095
author: Anton Gladky <gladk@xxxxxxxxxx>
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Sat 2014-07-19 23:36:19 +0200
message:
  Move many Gl1_* into Gl1_Primitives.
removed:
  pkg/common/GLDrawFunctors.cpp
  pkg/common/Gl1_Aabb.cpp
  pkg/common/Gl1_Aabb.hpp
  pkg/common/Gl1_Box.cpp
  pkg/common/Gl1_Box.hpp
  pkg/common/Gl1_Facet.cpp
  pkg/common/Gl1_Facet.hpp
  pkg/common/Gl1_Sphere.cpp
  pkg/common/Gl1_Sphere.hpp
added:
  pkg/common/Gl1_Primitives.cpp
  pkg/common/Gl1_Primitives.hpp


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== removed file 'pkg/common/GLDrawFunctors.cpp'
--- pkg/common/GLDrawFunctors.cpp	2010-11-19 12:30:08 +0000
+++ pkg/common/GLDrawFunctors.cpp	1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-#include<yade/pkg/common/GLDrawFunctors.hpp>
-#ifdef YADE_OPENGL
-	YADE_PLUGIN(
-		(GlBoundFunctor)(GlShapeFunctor)(GlIGeomFunctor)(GlIPhysFunctor)(GlStateFunctor)
-		(GlBoundDispatcher)(GlShapeDispatcher)(GlIGeomDispatcher)(GlIPhysDispatcher)(GlStateDispatcher)
-	);
-#endif

=== removed file 'pkg/common/Gl1_Aabb.cpp'
--- pkg/common/Gl1_Aabb.cpp	2010-11-19 12:30:08 +0000
+++ pkg/common/Gl1_Aabb.cpp	1970-01-01 00:00:00 +0000
@@ -1,33 +0,0 @@
-/*************************************************************************
-*  Copyright (C) 2004 by Olivier Galizzi                                 *
-*  olivier.galizzi@xxxxxxx                                               *
-*                                                                        *
-*  This program is free software; it is licensed under the terms of the  *
-*  GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-
-#ifdef YADE_OPENGL
-
-#include"Gl1_Aabb.hpp"
-#include<yade/lib/opengl/OpenGLWrapper.hpp>
-#include<yade/pkg/common/Aabb.hpp>
-#include<yade/core/Scene.hpp>
-
-void Gl1_Aabb::go(const shared_ptr<Bound>& bv, Scene* scene){
-	Aabb* aabb = static_cast<Aabb*>(bv.get());
-	glColor3v(bv->color);
-	// glDisable(GL_LIGHTING);
-	if(!scene->isPeriodic){
-		glTranslatev(Vector3r(.5*(aabb->min+aabb->max)));
-		glScalev(Vector3r(aabb->max-aabb->min));
-	} else {
-		glTranslatev(Vector3r(scene->cell->shearPt(scene->cell->wrapPt(.5*(aabb->min+aabb->max)))));
-		glMultMatrixd(scene->cell->getGlShearTrsfMatrix());
-		glScalev(Vector3r(aabb->max-aabb->min));
-	}
-	glutWireCube(1);
-}
-
-YADE_PLUGIN((Gl1_Aabb));
-
-#endif /* YADE_OPENGL */

=== removed file 'pkg/common/Gl1_Aabb.hpp'
--- pkg/common/Gl1_Aabb.hpp	2011-01-10 08:08:23 +0000
+++ pkg/common/Gl1_Aabb.hpp	1970-01-01 00:00:00 +0000
@@ -1,22 +0,0 @@
-/*************************************************************************
-*  Copyright (C) 2004 by Olivier Galizzi                                 *
-*  olivier.galizzi@xxxxxxx                                               *
-*                                                                        *
-*  This program is free software; it is licensed under the terms of the  *
-*  GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-
-#pragma once
-
-#include<yade/pkg/common/GLDrawFunctors.hpp>
-#include<yade/pkg/common/Aabb.hpp>
-
-class Gl1_Aabb: public GlBoundFunctor{
-	public:
-		virtual void go(const shared_ptr<Bound>&, Scene*);
-	RENDERS(Aabb);
-	YADE_CLASS_BASE_DOC(Gl1_Aabb,GlBoundFunctor,"Render Axis-aligned bounding box (:yref:`Aabb`).");
-};
-REGISTER_SERIALIZABLE(Gl1_Aabb);
-
-

=== removed file 'pkg/common/Gl1_Box.cpp'
--- pkg/common/Gl1_Box.cpp	2010-11-19 12:30:08 +0000
+++ pkg/common/Gl1_Box.cpp	1970-01-01 00:00:00 +0000
@@ -1,29 +0,0 @@
-/*************************************************************************
-*  Copyright (C) 2004 by Olivier Galizzi                                 *
-*  olivier.galizzi@xxxxxxx                                               *
-*                                                                        *
-*  This program is free software; it is licensed under the terms of the  *
-*  GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-
-#ifdef YADE_OPENGL
-
-#include "Gl1_Box.hpp"
-#include<yade/pkg/common/Box.hpp>
-#include<yade/lib/opengl/OpenGLWrapper.hpp>
-
-void Gl1_Box::go(const shared_ptr<Shape>& cg, const shared_ptr<State>&,bool wire,const GLViewInfo&)
-{
-	glColor3v(cg->color);
-	
-	Vector3r &extents = (static_cast<Box*>(cg.get()))->extents;
-	
-	glScalef(2*extents[0],2*extents[1],2*extents[2]);
-
- 	if (wire) glutWireCube(1);
- 	else glutSolidCube(1);
-}
-
-YADE_PLUGIN((Gl1_Box));
-
-#endif

=== removed file 'pkg/common/Gl1_Box.hpp'
--- pkg/common/Gl1_Box.hpp	2011-01-10 08:08:23 +0000
+++ pkg/common/Gl1_Box.hpp	1970-01-01 00:00:00 +0000
@@ -1,23 +0,0 @@
-/*************************************************************************
-*  Copyright (C) 2004 by Olivier Galizzi                                 *
-*  olivier.galizzi@xxxxxxx                                               *
-*                                                                        *
-*  This program is free software; it is licensed under the terms of the  *
-*  GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-
-#pragma once
-
-#include<yade/pkg/common/GLDrawFunctors.hpp>
-#include<yade/pkg/common/Box.hpp>
-
-class Gl1_Box : public GlShapeFunctor{
-	public :
-		virtual void go(const shared_ptr<Shape>&, const shared_ptr<State>&,bool,const GLViewInfo&);
-	RENDERS(Box);
-	YADE_CLASS_BASE_DOC(Gl1_Box,GlShapeFunctor,"Renders :yref:`Box` object");
-};
-
-REGISTER_SERIALIZABLE(Gl1_Box);
-
-

=== removed file 'pkg/common/Gl1_Facet.cpp'
--- pkg/common/Gl1_Facet.cpp	2011-02-14 08:05:09 +0000
+++ pkg/common/Gl1_Facet.cpp	1970-01-01 00:00:00 +0000
@@ -1,61 +0,0 @@
-/*************************************************************************
-*  Copyright (C) 2008 by Sergei Dorofeenko				 *
-*  sega@xxxxxxxxxxxxxxxx                                                 *
-*                                                                        *
-*  This program is free software; it is licensed under the terms of the  *
-*  GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-
-#ifdef YADE_OPENGL
-
-#include<yade/pkg/common/Gl1_Facet.hpp>
-#include<yade/pkg/common/Facet.hpp>
-#include<yade/lib/opengl/OpenGLWrapper.hpp>
-
-bool Gl1_Facet::normals=false;
-
-void Gl1_Facet::go(const shared_ptr<Shape>& cm, const shared_ptr<State>& ,bool wire,const GLViewInfo&)
-{   
-	Facet* facet = static_cast<Facet*>(cm.get());
-	const vector<Vector3r>& vertices = facet->vertices;
-	const Vector3r* ne = facet->ne;
-	const Real& icr = facet->icr;
-
-	if(cm->wire || wire){
-		// facet
-		glBegin(GL_LINE_LOOP);
-			glColor3v(normals ? Vector3r(1,0,0): cm->color);
-		   glVertex3v(vertices[0]);
-		   glVertex3v(vertices[1]);
-		   glVertex3v(vertices[2]);
-	    glEnd();
-		if(!normals) return;
-		// facet's normal 
-		glBegin(GL_LINES);
-			glColor3(0.0,0.0,1.0); 
-			glVertex3(0.0,0.0,0.0);
-			glVertex3v(facet->normal);
-		glEnd();
-		// normal of edges
-		glColor3(0.0,0.0,1.0); 
-		glBegin(GL_LINES);
-			glVertex3(0.0,0.0,0.0); glVertex3v(Vector3r(icr*ne[0]));
-			glVertex3(0.0,0.0,0.0);	glVertex3v(Vector3r(icr*ne[1]));
-			glVertex3(0.0,0.0,0.0);	glVertex3v(Vector3r(icr*ne[2]));
-		glEnd();
-	} else {
-		glDisable(GL_CULL_FACE); 
-		Vector3r normal=(facet->vertices[1]-facet->vertices[0]).cross(facet->vertices[2]-facet->vertices[1]); normal.normalize();
-		glColor3v(cm->color);
-		glBegin(GL_TRIANGLES);
-			glNormal3v(normal); // this makes every triangle different WRT the light direction; important!
-			glVertex3v(facet->vertices[0]);
-			glVertex3v(facet->vertices[1]);
-			glVertex3v(facet->vertices[2]);
-		glEnd();
-	}
-}
-
-YADE_PLUGIN((Gl1_Facet));
-
-#endif /* YADE_OPENGL */

=== removed file 'pkg/common/Gl1_Facet.hpp'
--- pkg/common/Gl1_Facet.hpp	2011-01-09 16:34:50 +0000
+++ pkg/common/Gl1_Facet.hpp	1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-/*************************************************************************
-*  Copyright (C) 2008 by Sergei Dorofeenko				 *
-*  sega@xxxxxxxxxxxxxxxx                                                 *
-*                                                                        *
-*  This program is free software; it is licensed under the terms of the  *
-*  GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-
-#pragma once
-
-#include<yade/pkg/common/GLDrawFunctors.hpp>
-#include<yade/pkg/common/Facet.hpp>
-
-class Gl1_Facet : public GlShapeFunctor
-{	
-	public:
-		virtual void go(const shared_ptr<Shape>&, const shared_ptr<State>&,bool,const GLViewInfo&);
-	RENDERS(Facet);
-	YADE_CLASS_BASE_DOC_STATICATTRS(Gl1_Facet,GlShapeFunctor,"Renders :yref:`Facet` object",
-		((bool,normals,false,,"In wire mode, render normals of facets and edges; facet's :yref:`colors<Shape::color>` are disregarded in that case."))
-	);
-};
-
-REGISTER_SERIALIZABLE(Gl1_Facet);
-
-

=== added file 'pkg/common/Gl1_Primitives.cpp'
--- pkg/common/Gl1_Primitives.cpp	1970-01-01 00:00:00 +0000
+++ pkg/common/Gl1_Primitives.cpp	2014-07-19 21:36:19 +0000
@@ -0,0 +1,225 @@
+/*************************************************************************
+*  Copyright (C) 2004 by Olivier Galizzi                                 *
+*  olivier.galizzi@xxxxxxx                                               *
+*                                                                        *
+*  Copyright (C) 2008 by Sergei Dorofeenko                               *
+*  sega@xxxxxxxxxxxxxxxx                                                 *
+*                                                                        *
+*  © 2008 Václav Šmilauer <eudoxos@xxxxxxxx>                             *
+*                                                                        *
+*  © 2008 Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>                    *
+*                                                                        *
+*  This program is free software; it is licensed under the terms of the  *
+*  GNU General Public License v2 or later. See file LICENSE for details. *
+*************************************************************************/
+
+#ifdef YADE_OPENGL
+
+#include "Gl1_Primitives.hpp"
+#include <yade/lib/opengl/OpenGLWrapper.hpp>
+#include <yade/core/Scene.hpp>
+
+YADE_PLUGIN((Gl1_Aabb)(Gl1_Box)(Gl1_Facet));
+YADE_PLUGIN((GlBoundFunctor)(GlShapeFunctor)(GlIGeomFunctor)(GlIPhysFunctor)(GlStateFunctor)
+            (GlBoundDispatcher)(GlShapeDispatcher)(GlIGeomDispatcher)(GlIPhysDispatcher)
+            (GlStateDispatcher));
+
+
+void Gl1_Aabb::go(const shared_ptr<Bound>& bv, Scene* scene){
+	Aabb* aabb = static_cast<Aabb*>(bv.get());
+	glColor3v(bv->color);
+	if(!scene->isPeriodic){
+		glTranslatev(Vector3r(.5*(aabb->min+aabb->max)));
+		glScalev(Vector3r(aabb->max-aabb->min));
+	} else {
+		glTranslatev(Vector3r(scene->cell->shearPt(scene->cell->wrapPt(.5*(aabb->min+aabb->max)))));
+		glMultMatrixd(scene->cell->getGlShearTrsfMatrix());
+		glScalev(Vector3r(aabb->max-aabb->min));
+	}
+	glutWireCube(1);
+}
+
+void Gl1_Box::go(const shared_ptr<Shape>& cg, const shared_ptr<State>&,bool wire,const GLViewInfo&)
+{
+	glColor3v(cg->color);
+	Vector3r &extents = (static_cast<Box*>(cg.get()))->extents;
+	glScalef(2*extents[0],2*extents[1],2*extents[2]);
+	if (wire) glutWireCube(1);
+	else glutSolidCube(1);
+}
+
+
+bool Gl1_Facet::normals=false;
+
+void Gl1_Facet::go(const shared_ptr<Shape>& cm, const shared_ptr<State>& ,bool wire,const GLViewInfo&)
+{   
+	Facet* facet = static_cast<Facet*>(cm.get());
+	const vector<Vector3r>& vertices = facet->vertices;
+	const Vector3r* ne = facet->ne;
+	const Real& icr = facet->icr;
+
+	if(cm->wire || wire){
+		// facet
+		glBegin(GL_LINE_LOOP);
+			glColor3v(normals ? Vector3r(1,0,0): cm->color);
+		   glVertex3v(vertices[0]);
+		   glVertex3v(vertices[1]);
+		   glVertex3v(vertices[2]);
+	    glEnd();
+		if(!normals) return;
+		// facet's normal 
+		glBegin(GL_LINES);
+			glColor3(0.0,0.0,1.0); 
+			glVertex3(0.0,0.0,0.0);
+			glVertex3v(facet->normal);
+		glEnd();
+		// normal of edges
+		glColor3(0.0,0.0,1.0); 
+		glBegin(GL_LINES);
+			glVertex3(0.0,0.0,0.0); glVertex3v(Vector3r(icr*ne[0]));
+			glVertex3(0.0,0.0,0.0);	glVertex3v(Vector3r(icr*ne[1]));
+			glVertex3(0.0,0.0,0.0);	glVertex3v(Vector3r(icr*ne[2]));
+		glEnd();
+	} else {
+		glDisable(GL_CULL_FACE); 
+		Vector3r normal=(facet->vertices[1]-facet->vertices[0]).cross(facet->vertices[2]-facet->vertices[1]); normal.normalize();
+		glColor3v(cm->color);
+		glBegin(GL_TRIANGLES);
+			glNormal3v(normal); // this makes every triangle different WRT the light direction; important!
+			glVertex3v(facet->vertices[0]);
+			glVertex3v(facet->vertices[1]);
+			glVertex3v(facet->vertices[2]);
+		glEnd();
+	}
+}
+
+// Spheres==========================================
+
+bool Gl1_Sphere::wire;
+bool Gl1_Sphere::stripes;
+int  Gl1_Sphere::glutSlices;
+int  Gl1_Sphere::glutStacks;
+Real  Gl1_Sphere::quality;
+bool  Gl1_Sphere::localSpecView;
+vector<Vector3r> Gl1_Sphere::vertices, Gl1_Sphere::faces;
+int Gl1_Sphere::glStripedSphereList=-1;
+int Gl1_Sphere::glGlutSphereList=-1;
+Real  Gl1_Sphere::prevQuality=0;
+
+void Gl1_Sphere::go(const shared_ptr<Shape>& cm, const shared_ptr<State>& ,bool wire2, const GLViewInfo&)
+{
+	glClearDepth(1.0f);
+	glEnable(GL_NORMALIZE);
+
+	Real r=(static_cast<Sphere*>(cm.get()))->radius;
+	glColor3v(cm->color);
+	if (wire || wire2) glutWireSphere(r,quality*glutSlices,quality*glutStacks);
+	else {
+		//Check if quality has been modified or if previous lists are invalidated (e.g. by creating a new qt view), then regenerate lists
+		bool somethingChanged = (std::abs(quality-prevQuality)>0.001 || glIsList(glStripedSphereList)!=GL_TRUE);
+		if (somethingChanged) {initStripedGlList(); initGlutGlList(); prevQuality=quality;}
+		glScalef(r,r,r);
+		if(stripes) glCallList(glStripedSphereList);
+		else glCallList(glGlutSphereList);
+	}
+	return;
+}
+YADE_PLUGIN((Gl1_Sphere));
+
+void Gl1_Sphere::subdivideTriangle(Vector3r& v1,Vector3r& v2,Vector3r& v3, int depth){
+	Vector3r v;
+	//Change color only at the appropriate level, i.e. 8 times in total, since we draw 8 mono-color sectors one after another
+	if (depth==int(quality) || quality<=0){
+		v = (v1+v2+v3)/3.0;
+		GLfloat matEmit[4];
+		if (v[1]*v[0]*v[2]>0){
+			matEmit[0] = 0.3;
+			matEmit[1] = 0.3;
+			matEmit[2] = 0.3;
+			matEmit[3] = 1.f;
+		}else{
+			matEmit[0] = 0.15;
+			matEmit[1] = 0.15;
+			matEmit[2] = 0.15;
+			matEmit[3] = 0.2;
+		}
+ 		glMaterialfv(GL_FRONT, GL_EMISSION, matEmit);
+	}
+	if (depth==1){//Then display 4 triangles
+		Vector3r v12 = v1+v2;
+		Vector3r v23 = v2+v3;
+		Vector3r v31 = v3+v1;
+		v12.normalize();
+		v23.normalize();
+		v31.normalize();
+		//Use TRIANGLE_STRIP for faster display of adjacent facets
+		glBegin(GL_TRIANGLE_STRIP);
+			glNormal3v(v1); glVertex3v(v1);
+			glNormal3v(v31); glVertex3v(v31);
+			glNormal3v(v12); glVertex3v(v12);
+			glNormal3v(v23); glVertex3v(v23);
+			glNormal3v(v2); glVertex3v(v2);
+		glEnd();
+		//terminate with this triangle left behind
+		glBegin(GL_TRIANGLES);
+			glNormal3v(v3); glVertex3v(v3);
+			glNormal3v(v23); glVertex3v(v23);
+			glNormal3v(v31); glVertex3v(v31);
+		glEnd();
+		return;
+	}
+	Vector3r v12 = v1+v2;
+	Vector3r v23 = v2+v3;
+	Vector3r v31 = v3+v1;
+	v12.normalize();
+	v23.normalize();
+	v31.normalize();
+	subdivideTriangle(v1,v12,v31,depth-1);
+	subdivideTriangle(v2,v23,v12,depth-1);
+	subdivideTriangle(v3,v31,v23,depth-1);
+	subdivideTriangle(v12,v23,v31,depth-1);
+}
+
+void Gl1_Sphere::initStripedGlList() {
+	if (!vertices.size()){//Fill vectors with vertices and facets
+		//Define 6 points for +/- coordinates
+		vertices.push_back(Vector3r(-1,0,0));//0
+		vertices.push_back(Vector3r(1,0,0));//1
+		vertices.push_back(Vector3r(0,-1,0));//2
+		vertices.push_back(Vector3r(0,1,0));//3
+		vertices.push_back(Vector3r(0,0,-1));//4
+		vertices.push_back(Vector3r(0,0,1));//5
+		//Define 8 sectors of the sphere
+		faces.push_back(Vector3r(3,4,1));
+		faces.push_back(Vector3r(3,0,4));
+		faces.push_back(Vector3r(3,5,0));
+		faces.push_back(Vector3r(3,1,5));
+		faces.push_back(Vector3r(2,1,4));
+		faces.push_back(Vector3r(2,4,0));
+		faces.push_back(Vector3r(2,0,5));
+		faces.push_back(Vector3r(2,5,1));
+	}
+	//Generate the list. Only once for each qtView, or more if quality is modified.
+	glDeleteLists(glStripedSphereList,1);
+	glStripedSphereList = glGenLists(1);
+	glNewList(glStripedSphereList,GL_COMPILE);
+	glEnable(GL_LIGHTING);
+	glShadeModel(GL_SMOOTH);
+	// render the sphere now
+	for (int i=0;i<8;i++)
+		subdivideTriangle(vertices[(unsigned int)faces[i][0]],vertices[(unsigned int)faces[i][1]],vertices[(unsigned int)faces[i][2]],1+ (int) quality);
+	glEndList();
+
+}
+
+void Gl1_Sphere::initGlutGlList(){
+	//Generate the "no-stripes" display list, each time quality is modified
+	glDeleteLists(glGlutSphereList,1);
+	glGlutSphereList = glGenLists(1);
+	glNewList(glGlutSphereList,GL_COMPILE);
+		glEnable(GL_LIGHTING);
+		glShadeModel(GL_SMOOTH);
+		glutSolidSphere(1.0,max(quality*glutSlices,(Real)2.),max(quality*glutStacks,(Real)3.));
+	glEndList();
+}
+#endif /* YADE_OPENGL */

=== added file 'pkg/common/Gl1_Primitives.hpp'
--- pkg/common/Gl1_Primitives.hpp	1970-01-01 00:00:00 +0000
+++ pkg/common/Gl1_Primitives.hpp	2014-07-19 21:36:19 +0000
@@ -0,0 +1,81 @@
+/*************************************************************************
+*  Copyright (C) 2004 by Olivier Galizzi                                 *
+*  olivier.galizzi@xxxxxxx                                               *
+*                                                                        *
+*  Copyright (C) 2008 by Sergei Dorofeenko                               *
+*  sega@xxxxxxxxxxxxxxxx                                                 *
+*                                                                        *
+*  © 2008 Václav Šmilauer <eudoxos@xxxxxxxx>                             *
+*                                                                        *
+*  © 2008 Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>                    *
+*                                                                        *
+*  This program is free software; it is licensed under the terms of the  *
+*  GNU General Public License v2 or later. See file LICENSE for details. *
+*************************************************************************/
+
+#pragma once
+
+#include<yade/pkg/common/GLDrawFunctors.hpp>
+#include<yade/pkg/common/Aabb.hpp>
+#include<yade/pkg/common/Box.hpp>
+#include<yade/pkg/common/Facet.hpp>
+#include<yade/pkg/common/Sphere.hpp>
+
+class Gl1_Aabb: public GlBoundFunctor{
+	public:
+		virtual void go(const shared_ptr<Bound>&, Scene*);
+	RENDERS(Aabb);
+	YADE_CLASS_BASE_DOC(Gl1_Aabb,GlBoundFunctor,"Render Axis-aligned bounding box (:yref:`Aabb`).");
+};
+REGISTER_SERIALIZABLE(Gl1_Aabb);
+
+
+class Gl1_Box : public GlShapeFunctor{
+	public :
+		virtual void go(const shared_ptr<Shape>&, const shared_ptr<State>&,bool,const GLViewInfo&);
+	RENDERS(Box);
+	YADE_CLASS_BASE_DOC(Gl1_Box,GlShapeFunctor,"Renders :yref:`Box` object");
+};
+
+REGISTER_SERIALIZABLE(Gl1_Box);
+
+class Gl1_Facet : public GlShapeFunctor
+{	
+	public:
+		virtual void go(const shared_ptr<Shape>&, const shared_ptr<State>&,bool,const GLViewInfo&);
+	RENDERS(Facet);
+	YADE_CLASS_BASE_DOC_STATICATTRS(Gl1_Facet,GlShapeFunctor,"Renders :yref:`Facet` object",
+		((bool,normals,false,,"In wire mode, render normals of facets and edges; facet's :yref:`colors<Shape::color>` are disregarded in that case."))
+	);
+};
+
+REGISTER_SERIALIZABLE(Gl1_Facet);
+
+
+class Gl1_Sphere : public GlShapeFunctor{
+	private:
+		// for stripes
+		static vector<Vector3r> vertices, faces;
+		static int glStripedSphereList;
+		static int glGlutSphereList;
+		void subdivideTriangle(Vector3r& v1,Vector3r& v2,Vector3r& v3, int depth);
+		//Generate GlList for GLUT sphere
+		void initGlutGlList();
+		//Generate GlList for sliced spheres
+		void initStripedGlList();
+		//for regenerating glutSphere list if needed
+		static Real prevQuality;
+	public:
+		virtual void go(const shared_ptr<Shape>&, const shared_ptr<State>&,bool,const GLViewInfo&);
+	YADE_CLASS_BASE_DOC_STATICATTRS(Gl1_Sphere,GlShapeFunctor,"Renders :yref:`Sphere` object",
+		((Real,quality,1.0,,"Change discretization level of spheres. quality>1  for better image quality, at the price of more cpu/gpu usage, 0<quality<1 for faster rendering. If mono-color spheres are displayed (:yref:`Gl1_Sphere::stripes` = False), quality mutiplies :yref:`Gl1_Sphere::glutSlices` and :yref:`Gl1_Sphere::glutStacks`. If striped spheres are displayed (:yref:`Gl1_Sphere::stripes` = True), only integer increments are meaningfull : quality=1 and quality=1.9 will give the same result, quality=2 will give finer result."))
+		((bool,wire,false,,"Only show wireframe (controlled by ``glutSlices`` and ``glutStacks``."))
+		((bool,stripes,false,,"In non-wire rendering, show stripes clearly showing particle rotation."))
+		((bool,localSpecView,true,,"Compute specular light in local eye coordinate system."))
+		((int,glutSlices,12,(Attr::noSave | Attr::readonly),"Base number of sphere slices, multiplied by :yref:`Gl1_Sphere::quality` before use); not used with ``stripes`` (see `glut{Solid,Wire}Sphere reference <http://www.opengl.org/documentation/specs/glut/spec3/node81.html>`_)"))
+		((int,glutStacks,6,(Attr::noSave | Attr::readonly),"Base number of sphere stacks, multiplied by :yref:`Gl1_Sphere::quality` before use; not used with ``stripes`` (see `glut{Solid,Wire}Sphere reference <http://www.opengl.org/documentation/specs/glut/spec3/node81.html>`_)"))
+	);
+	RENDERS(Sphere);
+};
+
+REGISTER_SERIALIZABLE(Gl1_Sphere);

=== removed file 'pkg/common/Gl1_Sphere.cpp'
--- pkg/common/Gl1_Sphere.cpp	2014-07-03 07:16:58 +0000
+++ pkg/common/Gl1_Sphere.cpp	1970-01-01 00:00:00 +0000
@@ -1,182 +0,0 @@
-/*************************************************************************
-*  © 2004 Olivier Galizzi  <olivier.galizzi@xxxxxxx>                     *
-*  © 2008 Václav Šmilauer <eudoxos@xxxxxxxx>                             *
-*  © 2008 Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>                    *
-*                                                                        *
-*  This program is free software; it is licensed under the terms of the  *
-*  GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-
-#ifdef YADE_OPENGL
-
-#include "Gl1_Sphere.hpp"
-#include<yade/pkg/common/Sphere.hpp>
-#include<yade/lib/opengl/OpenGLWrapper.hpp>
-
-bool Gl1_Sphere::wire;
-bool Gl1_Sphere::stripes;
-int  Gl1_Sphere::glutSlices;
-int  Gl1_Sphere::glutStacks;
-Real  Gl1_Sphere::quality;
-bool  Gl1_Sphere::localSpecView;
-vector<Vector3r> Gl1_Sphere::vertices, Gl1_Sphere::faces;
-int Gl1_Sphere::glStripedSphereList=-1;
-int Gl1_Sphere::glGlutSphereList=-1;
-Real  Gl1_Sphere::prevQuality=0;
-
-void Gl1_Sphere::go(const shared_ptr<Shape>& cm, const shared_ptr<State>& ,bool wire2, const GLViewInfo&)
-{
-	glClearDepth(1.0f);
-	glEnable(GL_NORMALIZE);
-
-	Real r=(static_cast<Sphere*>(cm.get()))->radius;
-	glColor3v(cm->color);
-	if (wire || wire2) glutWireSphere(r,quality*glutSlices,quality*glutStacks);
-	else {
-		//Check if quality has been modified or if previous lists are invalidated (e.g. by creating a new qt view), then regenerate lists
-		bool somethingChanged = (std::abs(quality-prevQuality)>0.001 || glIsList(glStripedSphereList)!=GL_TRUE);
-		if (somethingChanged) {initStripedGlList(); initGlutGlList(); prevQuality=quality;}
-		glScalef(r,r,r);
-		if(stripes) glCallList(glStripedSphereList);
-		else glCallList(glGlutSphereList);
-	}
-	return;
-}
-YADE_PLUGIN((Gl1_Sphere));
-
-void Gl1_Sphere::subdivideTriangle(Vector3r& v1,Vector3r& v2,Vector3r& v3, int depth){
-	Vector3r v;
-	//Change color only at the appropriate level, i.e. 8 times in total, since we draw 8 mono-color sectors one after another
-	if (depth==int(quality) || quality<=0){
-		v = (v1+v2+v3)/3.0;
-		GLfloat matEmit[4];
-		if (v[1]*v[0]*v[2]>0){
-			matEmit[0] = 0.3;
-			matEmit[1] = 0.3;
-			matEmit[2] = 0.3;
-			matEmit[3] = 1.f;
-		}else{
-			matEmit[0] = 0.15;
-			matEmit[1] = 0.15;
-			matEmit[2] = 0.15;
-			matEmit[3] = 0.2;
-		}
- 		glMaterialfv(GL_FRONT, GL_EMISSION, matEmit);
-	}
-	if (depth==1){//Then display 4 triangles
-		Vector3r v12 = v1+v2;
-		Vector3r v23 = v2+v3;
-		Vector3r v31 = v3+v1;
-		v12.normalize();
-		v23.normalize();
-		v31.normalize();
-		//Use TRIANGLE_STRIP for faster display of adjacent facets
-		glBegin(GL_TRIANGLE_STRIP);
-			glNormal3v(v1); glVertex3v(v1);
-			glNormal3v(v31); glVertex3v(v31);
-			glNormal3v(v12); glVertex3v(v12);
-			glNormal3v(v23); glVertex3v(v23);
-			glNormal3v(v2); glVertex3v(v2);
-		glEnd();
-		//terminate with this triangle left behind
-		glBegin(GL_TRIANGLES);
-			glNormal3v(v3); glVertex3v(v3);
-			glNormal3v(v23); glVertex3v(v23);
-			glNormal3v(v31); glVertex3v(v31);
-		glEnd();
-		return;
-	}
-	Vector3r v12 = v1+v2;
-	Vector3r v23 = v2+v3;
-	Vector3r v31 = v3+v1;
-	v12.normalize();
-	v23.normalize();
-	v31.normalize();
-	subdivideTriangle(v1,v12,v31,depth-1);
-	subdivideTriangle(v2,v23,v12,depth-1);
-	subdivideTriangle(v3,v31,v23,depth-1);
-	subdivideTriangle(v12,v23,v31,depth-1);
-}
-
-void Gl1_Sphere::initStripedGlList() {
-	if (!vertices.size()){//Fill vectors with vertices and facets
-		//Define 6 points for +/- coordinates
-		vertices.push_back(Vector3r(-1,0,0));//0
-		vertices.push_back(Vector3r(1,0,0));//1
-		vertices.push_back(Vector3r(0,-1,0));//2
-		vertices.push_back(Vector3r(0,1,0));//3
-		vertices.push_back(Vector3r(0,0,-1));//4
-		vertices.push_back(Vector3r(0,0,1));//5
-		//Define 8 sectors of the sphere
-		faces.push_back(Vector3r(3,4,1));
-		faces.push_back(Vector3r(3,0,4));
-		faces.push_back(Vector3r(3,5,0));
-		faces.push_back(Vector3r(3,1,5));
-		faces.push_back(Vector3r(2,1,4));
-		faces.push_back(Vector3r(2,4,0));
-		faces.push_back(Vector3r(2,0,5));
-		faces.push_back(Vector3r(2,5,1));
-	}
-	//Generate the list. Only once for each qtView, or more if quality is modified.
-	glDeleteLists(glStripedSphereList,1);
-	glStripedSphereList = glGenLists(1);
-	glNewList(glStripedSphereList,GL_COMPILE);
-	glEnable(GL_LIGHTING);
-	glShadeModel(GL_SMOOTH);
-	// render the sphere now
-	for (int i=0;i<8;i++)
-		subdivideTriangle(vertices[(unsigned int)faces[i][0]],vertices[(unsigned int)faces[i][1]],vertices[(unsigned int)faces[i][2]],1+ (int) quality);
-	glEndList();
-
-}
-
-void Gl1_Sphere::initGlutGlList(){
-	//Generate the "no-stripes" display list, each time quality is modified
-	glDeleteLists(glGlutSphereList,1);
-	glGlutSphereList = glGenLists(1);
-	glNewList(glGlutSphereList,GL_COMPILE);
-		glEnable(GL_LIGHTING);
-		glShadeModel(GL_SMOOTH);
-		glutSolidSphere(1.0,max(quality*glutSlices,(Real)2.),max(quality*glutStacks,(Real)3.));
-	glEndList();
-}
-
-#endif /* YADE_OPENGL */
-
-//      ///The old Galizzi's lists
-// 	if (!vertices.size()) {
-// 		Real X = 0.525731112119133606;
-// 		Real Z = 0.850650808352039932;
-// 		vertices.push_back(Vector3r(-X,0,Z));//0
-// 		vertices.push_back(Vector3r(X,0,Z));//1
-// 		vertices.push_back(Vector3r(-X,0,-Z));//2
-// 		vertices.push_back(Vector3r(X,0,-Z));//3
-// 		vertices.push_back(Vector3r(0,Z,X));//4
-// 		vertices.push_back(Vector3r(0,Z,-X));//5
-// 		vertices.push_back(Vector3r(0,-Z,X));//6
-// 		vertices.push_back(Vector3r(0,-Z,-X));//7
-// 		vertices.push_back(Vector3r(Z,X,0));//8
-// 		vertices.push_back(Vector3r(-Z,X,0));//9
-// 		vertices.push_back(Vector3r(Z,-X,0));//10
-// 		vertices.push_back(Vector3r(-Z,-X,0));//11
-// 		faces.push_back(Vector3r(0,4,1));
-// 		faces.push_back(Vector3r(0,9,4));
-// 		faces.push_back(Vector3r(9,5,4));
-// 		faces.push_back(Vector3r(4,5,8));
-// 		faces.push_back(Vector3r(4,8,1));
-// 		faces.push_back(Vector3r(8,10,1));
-// 		faces.push_back(Vector3r(8,3,10));
-// 		faces.push_back(Vector3r(5,3,8));
-// 		faces.push_back(Vector3r(5,2,3));
-// 		faces.push_back(Vector3r(2,7,3));
-// 		faces.push_back(Vector3r(7,10,3));
-// 		faces.push_back(Vector3r(7,6,10));
-// 		faces.push_back(Vector3r(7,11,6));
-// 		faces.push_back(Vector3r(11,0,6));
-// 		faces.push_back(Vector3r(0,1,6));
-// 		faces.push_back(Vector3r(6,1,10));
-// 		faces.push_back(Vector3r(9,0,11));
-// 		faces.push_back(Vector3r(9,11,2));
-// 		faces.push_back(Vector3r(9,2,5));
-// 		faces.push_back(Vector3r(7,2,11));}
-

=== removed file 'pkg/common/Gl1_Sphere.hpp'
--- pkg/common/Gl1_Sphere.hpp	2012-11-22 14:32:53 +0000
+++ pkg/common/Gl1_Sphere.hpp	1970-01-01 00:00:00 +0000
@@ -1,44 +0,0 @@
-/*************************************************************************
-*  © 2004 Olivier Galizzi  <olivier.galizzi@xxxxxxx>                     *
-*  © 2008 Václav Šmilauer <eudoxos@xxxxxxxx>                             *
-*  © 2008 Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>                    *
-*                                                                        *
-*  This program is free software; it is licensed under the terms of the  *
-*  GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-
-#pragma once
-
-#include<yade/pkg/common/GLDrawFunctors.hpp>
-#include<yade/pkg/common/Sphere.hpp>
-
-
-class Gl1_Sphere : public GlShapeFunctor{
-	private:
-		// for stripes
-		static vector<Vector3r> vertices, faces;
-		static int glStripedSphereList;
-		static int glGlutSphereList;
-		void subdivideTriangle(Vector3r& v1,Vector3r& v2,Vector3r& v3, int depth);
-// 		void drawSphere(const Vector3r& color);
-		//Generate GlList for GLUT sphere
-		void initGlutGlList();
-		//Generate GlList for sliced spheres
-		void initStripedGlList();
-		//for regenerating glutSphere list if needed
-		static Real prevQuality;
-	public:
-		virtual void go(const shared_ptr<Shape>&, const shared_ptr<State>&,bool,const GLViewInfo&);
-	YADE_CLASS_BASE_DOC_STATICATTRS(Gl1_Sphere,GlShapeFunctor,"Renders :yref:`Sphere` object",
-		((Real,quality,1.0,,"Change discretization level of spheres. quality>1  for better image quality, at the price of more cpu/gpu usage, 0<quality<1 for faster rendering. If mono-color spheres are displayed (:yref:`Gl1_Sphere::stripes` = False), quality mutiplies :yref:`Gl1_Sphere::glutSlices` and :yref:`Gl1_Sphere::glutStacks`. If striped spheres are displayed (:yref:`Gl1_Sphere::stripes` = True), only integer increments are meaningfull : quality=1 and quality=1.9 will give the same result, quality=2 will give finer result."))
-		((bool,wire,false,,"Only show wireframe (controlled by ``glutSlices`` and ``glutStacks``."))
-		((bool,stripes,false,,"In non-wire rendering, show stripes clearly showing particle rotation."))
-		((bool,localSpecView,true,,"Compute specular light in local eye coordinate system."))
-		((int,glutSlices,12,(Attr::noSave | Attr::readonly),"Base number of sphere slices, multiplied by :yref:`Gl1_Sphere::quality` before use); not used with ``stripes`` (see `glut{Solid,Wire}Sphere reference <http://www.opengl.org/documentation/specs/glut/spec3/node81.html>`_)"))
-		((int,glutStacks,6,(Attr::noSave | Attr::readonly),"Base number of sphere stacks, multiplied by :yref:`Gl1_Sphere::quality` before use; not used with ``stripes`` (see `glut{Solid,Wire}Sphere reference <http://www.opengl.org/documentation/specs/glut/spec3/node81.html>`_)"))
-	);
-	RENDERS(Sphere);
-};
-REGISTER_SERIALIZABLE(Gl1_Sphere);
-
-