Subversion Repositories gelsvn

Rev

Rev 373 | Rev 432 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 373 Rev 396
Line -... Line 1...
-
 
1
#include <GL/glew.h>
-
 
2
 
1
#include "CGLA/Mat4x4f.h"
3
#include "CGLA/Mat4x4f.h"
2
#include "CGLA/Vec3d.h"
4
#include "CGLA/Vec3d.h"
3
#include "gel_glu.h"
-
 
4
#include "draw.h"
5
#include "draw.h"
5
#include "HMesh/FaceCirculator.h"
6
#include "HMesh/FaceCirculator.h"
6
 
7
 
-
 
8
#include "SinglePassWireframeRenderer.h"
-
 
9
#include "IDBufferWireFrameRenderer.h"
-
 
10
 
7
using namespace CGLA;
11
using namespace CGLA;
8
using namespace HMesh;
12
using namespace HMesh;
9
using namespace std;
13
using namespace std;
10
 
14
 
11
namespace 
15
namespace 
Line 100... Line 104...
100
		}
104
		}
101
		glEnd();
105
		glEnd();
102
		glDisable(GL_TEXTURE_2D);
106
		glDisable(GL_TEXTURE_2D);
103
	}
107
	}
104
	
108
	
-
 
109
	
-
 
110
	 
-
 
111
	template<class T>
-
 
112
	void draw_wireframe_oldfashioned(T& m, bool per_vertex_norms, const Vec3f& line_color)
-
 
113
	{
-
 
114
		// Store state that we change
-
 
115
		glPushAttrib(GL_POLYGON_BIT);
-
 
116
		GLboolean lights_on;
-
 
117
		glGetBooleanv(GL_LIGHTING, &lights_on);
-
 
118
		Vec4f current_color;
-
 
119
		glGetFloatv(GL_CURRENT_COLOR, &current_color[0]);
-
 
120
		
-
 
121
		// Draw filled
-
 
122
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
 
123
		draw(m, per_vertex_norms);
-
 
124
		
-
 
125
		// Draw lines
-
 
126
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
 
127
		glDisable(GL_LIGHTING);
-
 
128
		glEnable(GL_POLYGON_OFFSET_LINE);
-
 
129
		glPolygonOffset(0,-5);
-
 
130
		glColor3fv(line_color.get());
-
 
131
		draw(m, per_vertex_norms);
-
 
132
		
-
 
133
		// Put back old state
-
 
134
		glColor3fv(current_color.get());
-
 
135
		if(lights_on) glEnable(GL_LIGHTING);
-
 
136
		glPopAttrib();
-
 
137
	}
-
 
138
	
-
 
139
	template
-
 
140
	void draw_wireframe_oldfashioned<HMesh::Manifold>(HMesh::Manifold& m, bool per_vertex_norms, const Vec3f& line_color);
-
 
141
 
-
 
142
	template
-
 
143
	void draw_wireframe_oldfashioned(Geometry::TriMesh& m, bool per_vertex_norms, const Vec3f& line_color);
-
 
144
 
-
 
145
	
105
	void draw(const Geometry::AABox& box)
146
	void draw(const Geometry::AABox& box)
106
	{
147
	{
107
		glBegin(GL_QUADS);
148
		glBegin(GL_QUADS);
108
		Vec3f norm_neg[] = {Vec3f(0,0,-1), Vec3f(-1,0,0), Vec3f(0,-1,0)};
149
		Vec3f norm_neg[] = {Vec3f(0,0,-1), Vec3f(-1,0,0), Vec3f(0,-1,0)};
109
		Vec3f norm_pos[] = {Vec3f(0,0, 1), Vec3f( 1,0,0), Vec3f(0, 1,0)};
150
		Vec3f norm_pos[] = {Vec3f(0,0, 1), Vec3f( 1,0,0), Vec3f(0, 1,0)};