Subversion Repositories gelsvn

Rev

Rev 412 | Rev 457 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 412 Rev 416
1
/*
1
/*
2
 *  harmonics.cpp
2
 *  harmonics.cpp
3
 *  GEL
3
 *  GEL
4
 *
4
 *
5
 *  Created by J. Andreas Bærentzen on 01/09/08.
5
 *  Created by J. Andreas Bærentzen on 01/09/08.
6
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
6
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
7
 *
7
 *
8
 */
8
 */
9
 
9
 
10
#include <iostream>
10
#include <iostream>
11
#include <CGLA/Vec3f.h>
11
#include <CGLA/Vec3f.h>
12
#include <CGLA/Vec3d.h>
12
#include <CGLA/Vec3d.h>
13
#include <LinAlg/Matrix.h>
13
#include <LinAlg/Matrix.h>
14
#include <LinAlg/Vector.h>
14
#include <LinAlg/Vector.h>
15
#include <LinAlg/LapackFunc.h>
15
#include <LinAlg/LapackFunc.h>
16
 
16
 
17
#include <GL/glew.h>
17
#include <GL/glew.h>
18
#include <GLGraphics/glsl_shader.h>
18
#include <GLGraphics/glsl_shader.h>
19
 
19
 
20
#include <HMesh/Manifold.h>
20
#include <HMesh/Manifold.h>
21
#include <HMesh/VertexCirculator.h>
21
#include <HMesh/VertexCirculator.h>
22
#include <HMesh/FaceCirculator.h>
22
#include <HMesh/FaceCirculator.h>
23
#include <HMesh/build_manifold.h>
23
#include <HMesh/build_manifold.h>
24
#include <HMesh/mesh_optimization.h>
24
#include <HMesh/mesh_optimization.h>
25
#include <HMesh/triangulate.h>
25
#include <HMesh/triangulate.h>
26
#include <HMesh/load.h>
26
#include <HMesh/load.h>
27
#include <HMesh/x3d_save.h>
27
#include <HMesh/x3d_save.h>
28
 
28
 
29
#include <GLConsole/GLConsole.h>
29
#include <GLConsole/GLConsole.h>
30
 
30
 
31
#include "harmonics.h"
31
#include "harmonics.h"
32
 
32
 
33
using namespace CGLA;
33
using namespace CGLA;
34
using namespace std;
34
using namespace std;
35
using namespace HMesh;
35
using namespace HMesh;
36
using namespace Geometry;
36
using namespace Geometry;
37
using namespace GLGraphics;
37
using namespace GLGraphics;
38
using namespace LinAlg;
38
using namespace LinAlg;
39
using namespace CVarUtils;
39
using namespace CVarUtils;
40
 
40
 
41
bool Harmonics::is_initialized=false;
41
bool Harmonics::is_initialized=false;
42
GLuint Harmonics::prog_P0;
42
GLuint Harmonics::prog_P0;
43
 
43
 
44
 
44
 
45
namespace
45
namespace
46
{
46
{
47
 
47
 
48
	string vss =
48
	string vss =
49
"#version 120\n"
49
"#version 120\n"
50
"#extension GL_EXT_gpu_shader4 : enable\n"
50
"#extension GL_EXT_gpu_shader4 : enable\n"
51
"	\n"
51
"	\n"
52
"	\n"
52
"	\n"
53
"	attribute float eigenvalue;\n"
53
"	attribute float eigenvalue;\n"
54
"	attribute float eigenvalue2;\n"
54
"	attribute float eigenvalue2;\n"
55
"	varying vec3 normal;\n"
55
"	varying vec3 normal;\n"
56
"	varying float eig;\n"
56
"	varying float eig;\n"
57
"	varying float eig2;\n"
57
"	varying float eig2;\n"
58
"	\n"
58
"	\n"
59
"	void main(void)\n"
59
"	void main(void)\n"
60
"	{\n"
60
"	{\n"
61
"		gl_Position =  ftransform();\n"
61
"		gl_Position =  ftransform();\n"
62
"		normal = normalize(gl_NormalMatrix * gl_Normal);\n"
62
"		normal = normalize(gl_NormalMatrix * gl_Normal);\n"
63
"		eig = eigenvalue;\n"
63
"		eig = eigenvalue;\n"
64
"		eig2 = eigenvalue2;\n"
64
"		eig2 = eigenvalue2;\n"
65
"	}\n";
65
"	}\n";
66
	
66
	
67
string fss = 	
67
string fss = 	
68
"#version 120\n"
68
"#version 120\n"
69
"#extension GL_EXT_gpu_shader4 : enable\n"
69
"#extension GL_EXT_gpu_shader4 : enable\n"
70
"	\n"
70
"	\n"
71
"	varying vec3 normal;\n"
71
"	varying vec3 normal;\n"
72
"	varying float eig;\n"
72
"	varying float eig;\n"
73
"	varying float eig2;\n"
73
"	varying float eig2;\n"
74
"	uniform float eig_max;\n"
74
"	uniform float eig_max;\n"
75
"	uniform float eig_max2;\n"
75
"	uniform float eig_max2;\n"
76
"	uniform bool do_highlight;\n"
76
"	uniform bool do_highlight;\n"
77
"	uniform bool do_diffuse;\n"
77
"	uniform bool do_diffuse;\n"
78
"	const vec3 light_dir = vec3(0,0,1);\n"
78
"	const vec3 light_dir = vec3(0,0,1);\n"
79
"	\n"
79
"	\n"
80
"	void main()\n"
80
"	void main()\n"
81
"	{\n"
81
"	{\n"
82
"		float dot_ln = dot(light_dir, normal);\n"
82
"		float dot_ln = dot(light_dir, normal);\n"
83
"		\n"
83
"		\n"
84
"		float eig_norm = eig/eig_max;\n"
84
"		float eig_norm = eig/eig_max;\n"
85
"		float stripe_signal = 100 * eig_norm;\n"
85
"		float stripe_signal = 100 * eig_norm;\n"
86
"		vec4 stripe_col = abs(stripe_signal) < 3.14 ? vec4(1,1,0,0) : vec4(.1,.1,.1,0);\n"
86
"		vec4 stripe_col = abs(stripe_signal) < 3.14 ? vec4(1,1,0,0) : vec4(.1,.1,.1,0);\n"
87
"		\n"
87
"		\n"
88
"		gl_FragColor = eig_norm * vec4(-1,0,1,0);\n"
88
"		gl_FragColor = eig_norm * vec4(-1,0,1,0);\n"
89
"		if(do_diffuse)   gl_FragColor *= dot_ln;\n"
89
"		if(do_diffuse)   gl_FragColor *= dot_ln;\n"
90
"		if(do_highlight) gl_FragColor += dot_ln*dot_ln*dot_ln*dot_ln*dot_ln*dot_ln*dot_ln*vec4(.5,.5,.5,0);\n"
90
"		if(do_highlight) gl_FragColor += dot_ln*dot_ln*dot_ln*dot_ln*dot_ln*dot_ln*dot_ln*vec4(.5,.5,.5,0);\n"
91
"		gl_FragColor += stripe_col * smoothstep(0.8,1.0,cos(stripe_signal));\n"
91
"		gl_FragColor += stripe_col * smoothstep(0.8,1.0,cos(stripe_signal));\n"
92
"	}\n";
92
"	}\n";
93
	
93
	
94
	double voronoi_area(VertexIter v)
94
	double voronoi_area(VertexIter v)
95
	{
95
	{
96
	double area_mixed = 0;
96
	double area_mixed = 0;
97
	//For each triangle T from the 1-ring neighborhood of x
97
	//For each triangle T from the 1-ring neighborhood of x
98
	for(VertexCirculator vc(v); !vc.end(); ++vc)
98
	for(VertexCirculator vc(v); !vc.end(); ++vc)
99
	{
99
	{
100
		FaceIter f = vc.get_face();
100
		FaceIter f = vc.get_face();
101
		double f_area = area(f);
101
		double f_area = area(f);
102
		
102
		
103
		HalfEdgeIter he = vc.get_halfedge();
103
		HalfEdgeIter he = vc.get_halfedge();
104
		Vec3d v1(he->vert->pos);
104
		Vec3d v1(he->vert->pos);
105
		Vec3d v2(he->next->vert->pos);
105
		Vec3d v2(he->next->vert->pos);
106
		Vec3d v0(he->next->next->vert->pos);
106
		Vec3d v0(he->next->next->vert->pos);
107
		
107
		
108
		double a0 = acos(dot(v1-v0, v2-v0)/(length(v1-v0)*length(v2-v0)));
108
		double a0 = acos(dot(v1-v0, v2-v0)/(length(v1-v0)*length(v2-v0)));
109
		double a1 = acos(dot(v2-v1, v0-v1)/(length(v2-v1)*length(v0-v1)));
109
		double a1 = acos(dot(v2-v1, v0-v1)/(length(v2-v1)*length(v0-v1)));
110
		double a2 = acos(dot(v0-v2, v1-v2)/(length(v0-v2)*length(v1-v2)));
110
		double a2 = acos(dot(v0-v2, v1-v2)/(length(v0-v2)*length(v1-v2)));
111
		
111
		
112
		if(a0>(M_PI/2.0) && a1>(M_PI/2.0) && a2>(M_PI/2.0)) // f is non-obtuse
112
		if(a0>(M_PI/2.0) && a1>(M_PI/2.0) && a2>(M_PI/2.0)) // f is non-obtuse
113
		{
113
		{
114
			// Add Voronoi formula (see Section 3.3)
114
			// Add Voronoi formula (see Section 3.3)
115
			area_mixed += (1.0/8) * 
115
			area_mixed += (1.0/8) * 
116
			((1.0/tan(a1)) * sqr_length(v2-v0) + 
116
			((1.0/tan(a1)) * sqr_length(v2-v0) + 
117
			 (1.0/tan(a2)) * sqr_length(v1-v0));
117
			 (1.0/tan(a2)) * sqr_length(v1-v0));
118
		}
118
		}
119
		else // Voronoi inappropriate
119
		else // Voronoi inappropriate
120
		{
120
		{
121
			// Add either area(f)/4 or area(f)/2
121
			// Add either area(f)/4 or area(f)/2
122
			if(a0>M_PI/2.0)// the angle of f at x is obtuse
122
			if(a0>M_PI/2.0)// the angle of f at x is obtuse
123
				area_mixed += f_area/2;
123
				area_mixed += f_area/2;
124
			else
124
			else
125
				area_mixed += f_area/4;
125
				area_mixed += f_area/4;
126
		}
126
		}
127
	}
127
	}
128
	return area_mixed;
128
	return area_mixed;
129
}
129
}
130
 
130
 
131
	double barycentric_area(VertexIter v)
131
	double barycentric_area(VertexIter v)
132
	{
132
	{
133
	double barea = 0;
133
	double barea = 0;
134
	//For each triangle T from the 1-ring neighborhood of x
134
	//For each triangle T from the 1-ring neighborhood of x
135
	for(VertexCirculator vc(v); !vc.end(); ++vc)
135
	for(VertexCirculator vc(v); !vc.end(); ++vc)
136
	{
136
	{
137
		FaceIter f = vc.get_face();
137
		FaceIter f = vc.get_face();
138
		barea += area(f)/3.0;
138
		barea += area(f)/3.0;
139
	}
139
	}
140
	return barea;
140
	return barea;
141
}
141
}
142
 
142
 
143
}
143
}
144
 
144
 
145
void Harmonics::make_laplace_operator()
145
void Harmonics::make_laplace_operator()
146
{
146
{
147
	Q.Resize(mani.no_vertices(), mani.no_vertices());
147
	Q.Resize(mani.no_vertices(), mani.no_vertices());
148
	
148
	
149
	for(VertexIter v = mani.vertices_begin(); v != mani.vertices_end(); ++v)
149
	for(VertexIter v = mani.vertices_begin(); v != mani.vertices_end(); ++v)
150
		if(!is_boundary(v))
150
		if(!is_boundary(v))
151
		{
151
		{
152
			int i = v->touched;
152
			int i = v->touched;
153
			double area_i = voronoi_area(v);
153
			double area_i = voronoi_area(v);
154
			Vec3d vertex(v->pos);
154
			Vec3d vertex(v->pos);
155
			Vec3d curv_normal(0);
155
			Vec3d curv_normal(0);
156
			double a_sum = 0;
156
			double a_sum = 0;
157
			for(VertexCirculator vc(v); !vc.end(); ++vc)
157
			for(VertexCirculator vc(v); !vc.end(); ++vc)
158
			{
158
			{
159
				int j = vc.get_vertex()->touched;
159
				int j = vc.get_vertex()->touched;
160
				double area_j = voronoi_area(vc.get_vertex());
160
				double area_j = voronoi_area(vc.get_vertex());
161
				HalfEdgeIter h = vc.get_halfedge();
161
				HalfEdgeIter h = vc.get_halfedge();
162
				Vec3d nbr(h->vert->pos);
162
				Vec3d nbr(h->vert->pos);
163
				Vec3d left(h->next->vert->pos);
163
				Vec3d left(h->next->vert->pos);
164
				Vec3d right(h->opp->prev->opp->vert->pos);
164
				Vec3d right(h->opp->prev->opp->vert->pos);
165
				
165
				
166
				double d_left = dot(normalize(nbr-left),
166
				double d_left = dot(normalize(nbr-left),
167
									normalize(vertex-left));
167
									normalize(vertex-left));
168
				double d_right = dot(normalize(nbr-right),
168
				double d_right = dot(normalize(nbr-right),
169
									 normalize(vertex-right));
169
									 normalize(vertex-right));
170
				double a_left  = acos(min(1.0, max(-1.0, d_left)));
170
				double a_left  = acos(min(1.0, max(-1.0, d_left)));
171
				double a_right = acos(min(1.0, max(-1.0, d_right)));
171
				double a_right = acos(min(1.0, max(-1.0, d_right)));
172
				
172
				
173
				double w = 1.0/tan(a_left) + 1.0/tan(a_right);
173
				double w = 1.0/tan(a_left) + 1.0/tan(a_right);
174
				
174
				
175
				Q[i][j] = -w/sqrt(area_i*area_j);						
175
				Q[i][j] = -w/sqrt(area_i*area_j);						
176
				//Q[i][j] = -1;						
176
				//Q[i][j] = -1;						
177
				a_sum += Q[i][j];
177
				a_sum += Q[i][j];
178
			}
178
			}
179
			Q[i][i] = -a_sum;
179
			Q[i][i] = -a_sum;
180
		}
180
		}
181
	EigenSolutionsSym(Q,V);
181
	EigenSolutionsSym(Q,V);
182
	
-
 
183
}
182
}
184
 
183
 
185
 
184
 
186
Harmonics::Harmonics(Manifold& _mani):mani(_mani)
185
Harmonics::Harmonics(Manifold& _mani):mani(_mani)
187
{
186
{
188
	assert(is_initialized);
187
	assert(is_initialized);
189
		
188
		
190
	triangulate(mani);
189
	triangulate(mani);
191
	mani.enumerate_vertices();
190
	mani.enumerate_vertices();
192
	maximum_eigenvalue = mani.no_vertices()-1;
191
	maximum_eigenvalue = mani.no_vertices()-1;
193
	make_laplace_operator();
192
	make_laplace_operator();
194
	
193
	
195
	proj.resize(maximum_eigenvalue);
194
	proj.resize(maximum_eigenvalue);
196
	max_eig_values.resize(maximum_eigenvalue, 1e-10f);
195
	max_eig_values.resize(maximum_eigenvalue, 1e-10f);
197
 
196
 
198
	for(int es=0; es<maximum_eigenvalue; ++es)
197
	for(int es=0; es<maximum_eigenvalue; ++es)
199
	{
198
	{
200
		proj[es] = Vec3d(0.0);
199
		proj[es] = Vec3d(0.0);
201
		for(VertexIter v=mani.vertices_begin(); v != mani.vertices_end(); ++v)
200
		for(VertexIter v=mani.vertices_begin(); v != mani.vertices_end(); ++v)
202
		{
201
		{
203
 
202
 
204
			proj[es] +=  Vec3d(v->pos) * Q[es][v->touched];
203
			proj[es] +=  Vec3d(v->pos) * Q[es][v->touched];
205
			max_eig_values[es] = max(max_eig_values[es], static_cast<float>(abs(Q[es][v->touched])));
204
			max_eig_values[es] = max(max_eig_values[es], static_cast<float>(abs(Q[es][v->touched])));
206
		}
205
		}
207
	}
206
	}
208
}
207
}
209
 
208
 
210
void Harmonics::add_frequency(int es, float scale)
209
void Harmonics::add_frequency(int es, float scale)
211
{
210
{
212
	if(es<maximum_eigenvalue)
211
	if(es<maximum_eigenvalue)
213
		for(VertexIter v=mani.vertices_begin(); v != mani.vertices_end(); ++v)
212
		for(VertexIter v=mani.vertices_begin(); v != mani.vertices_end(); ++v)
214
		{
213
		{
215
			Vec3f p = Vec3f(proj[es]);
214
			Vec3f p = Vec3f(proj[es]);
216
			double Qval = Q[es][v->touched];
215
			double Qval = Q[es][v->touched];
217
			
216
			
218
			v->pos += p * Qval * scale; 	
217
			v->pos += p * Qval * scale; 	
219
		}
218
		}
220
}
219
}
221
 
220
 
222
void Harmonics::reset_shape()
221
void Harmonics::reset_shape()
223
{
222
{
224
	for(VertexIter v=mani.vertices_begin(); v != mani.vertices_end(); ++v)
223
	for(VertexIter v=mani.vertices_begin(); v != mani.vertices_end(); ++v)
225
		v->pos = Vec3f(0);	
224
		v->pos = Vec3f(0);	
226
}
225
}
227
void Harmonics::partial_reconstruct(int E0, int E1, float scale)
226
void Harmonics::partial_reconstruct(int E0, int E1, float scale)
228
{
227
{
229
	for(int es=E0;es<=E1;++es)
228
	for(int es=E0;es<=E1;++es)
230
		add_frequency(es, scale);
229
		add_frequency(es, scale);
231
}
230
}
232
 
231
 
233
void Harmonics::parse_key(unsigned char key)
232
void Harmonics::parse_key(unsigned char key)
234
{
233
{
235
		int& display_eigenvalue = GetCVarRef<int>("display.harmonics.eigenvalue");
234
		int& display_eigenvalue = GetCVarRef<int>("display.harmonics.eigenvalue");
236
		int& display_diffuse = GetCVarRef<int>("display.harmonics.diffuse");
235
		int& display_diffuse = GetCVarRef<int>("display.harmonics.diffuse");
237
		int& display_highlight = GetCVarRef<int>("display.harmonics.highlight");
236
		int& display_highlight = GetCVarRef<int>("display.harmonics.highlight");
238
		switch(key) {
237
		switch(key) {
239
			case '+': 
238
			case '+': 
240
				display_eigenvalue = min(display_eigenvalue+1, maximum_eigenvalue); 
239
				display_eigenvalue = min(display_eigenvalue+1, maximum_eigenvalue); 
241
				break;
240
				break;
242
			case '-': 
241
			case '-': 
243
				display_eigenvalue = max(display_eigenvalue-1, 0); 
242
				display_eigenvalue = max(display_eigenvalue-1, 0); 
244
				break;
243
				break;
245
			case 'd':	
244
			case 'd':	
246
				display_diffuse = !display_diffuse; 
245
				display_diffuse = !display_diffuse; 
247
				break;
246
				break;
248
			case 'h':
247
			case 'h':
249
				display_highlight = !display_highlight;
248
				display_highlight = !display_highlight;
250
				break;			
249
				break;			
251
		}
250
		}
252
 
251
 
253
}
252
}
254
 
253
 
255
void Harmonics::draw()
254
void Harmonics::draw()
256
{
255
{
257
	int& display_eigen = GetCVarRef<int>("display.harmonics.eigenvalue");
256
	int& display_eigen = GetCVarRef<int>("display.harmonics.eigenvalue");
258
	int& display_eigen2 = GetCVarRef<int>("display.harmonics.eigenvalue");
257
	int& display_eigen2 = GetCVarRef<int>("display.harmonics.eigenvalue");
259
	int& do_diffuse = GetCVarRef<int>("display.harmonics.diffuse");
258
	int& do_diffuse = GetCVarRef<int>("display.harmonics.diffuse");
260
	int& do_highlight = GetCVarRef<int>("display.harmonics.highlight");
259
	int& do_highlight = GetCVarRef<int>("display.harmonics.highlight");
261
 
260
 
262
 
261
 
263
	glUseProgram(prog_P0);
262
	glUseProgram(prog_P0);
264
	glUniform1f(glGetUniformLocation(prog_P0,"eig_max"),max_eig_values[display_eigen]);
263
	glUniform1f(glGetUniformLocation(prog_P0,"eig_max"),max_eig_values[display_eigen]);
265
	glUniform1f(glGetUniformLocation(prog_P0,"eig_max2"),max_eig_values[display_eigen2]);
264
	glUniform1f(glGetUniformLocation(prog_P0,"eig_max2"),max_eig_values[display_eigen2]);
266
	glUniform1i(glGetUniformLocation(prog_P0,"do_diffuse"),do_diffuse);
265
	glUniform1i(glGetUniformLocation(prog_P0,"do_diffuse"),do_diffuse);
267
   	glUniform1i(glGetUniformLocation(prog_P0,"do_highlight"),do_highlight);
266
   	glUniform1i(glGetUniformLocation(prog_P0,"do_highlight"),do_highlight);
268
	GLuint attrib = glGetAttribLocationARB(prog_P0, "eigenvalue");
267
	GLuint attrib = glGetAttribLocationARB(prog_P0, "eigenvalue");
269
	GLuint attrib2 = glGetAttribLocationARB(prog_P0, "eigenvalue2");
268
	GLuint attrib2 = glGetAttribLocationARB(prog_P0, "eigenvalue2");
270
	
269
	
271
	glFrontFace(GL_CW);
270
	glFrontFace(GL_CW);
272
	for(FaceIter f=mani.faces_begin(); f != mani.faces_end(); ++f)
271
	for(FaceIter f=mani.faces_begin(); f != mani.faces_end(); ++f)
273
	{
272
	{
274
		FaceCirculator fc(f);
273
		FaceCirculator fc(f);
275
		glBegin(GL_TRIANGLES);
274
		glBegin(GL_TRIANGLES);
276
		while(!fc.end())
275
		while(!fc.end())
277
		{
276
		{
278
			int i = fc.get_vertex()->touched;
277
			int i = fc.get_vertex()->touched;
279
			glVertexAttrib1f(attrib,Q[display_eigen][i]);
278
			glVertexAttrib1f(attrib,Q[display_eigen][i]);
280
			glVertexAttrib1f(attrib2,Q[display_eigen2][i]);
279
			glVertexAttrib1f(attrib2,Q[display_eigen2][i]);
281
			glNormal3fv(normal(fc.get_vertex()).get());
280
			glNormal3fv(normal(fc.get_vertex()).get());
282
			glVertex3fv(fc.get_vertex()->pos.get());
281
			glVertex3fv(fc.get_vertex()->pos.get());
283
			++fc;
282
			++fc;
284
		}
283
		}
285
		glEnd();
284
		glEnd();
286
	}
285
	}
287
	glFrontFace(GL_CCW);
286
	glFrontFace(GL_CCW);
288
	glUseProgram(0);
287
	glUseProgram(0);
289
}
288
}
290
 
289
 
291
void Harmonics::init()
290
void Harmonics::init()
292
{
291
{
293
	is_initialized = true;
292
	is_initialized = true;
294
	string shader_path = "/Users/jab/GEL/apps/MeshEdit/";
293
	string shader_path = "/Users/jab/GEL/apps/MeshEdit/";
295
	GLuint vs = create_glsl_shader(GL_VERTEX_SHADER, vss);
294
	GLuint vs = create_glsl_shader(GL_VERTEX_SHADER, vss);
296
	GLuint fs = create_glsl_shader(GL_FRAGMENT_SHADER, fss);
295
	GLuint fs = create_glsl_shader(GL_FRAGMENT_SHADER, fss);
297
	
296
	
298
	// Create the program
297
	// Create the program
299
	prog_P0 = glCreateProgram();
298
	prog_P0 = glCreateProgram();
300
	
299
	
301
	// Attach all shaders
300
	// Attach all shaders
302
	if(vs) glAttachShader(prog_P0, vs);
301
	if(vs) glAttachShader(prog_P0, vs);
303
	if(fs) glAttachShader(prog_P0, fs);
302
	if(fs) glAttachShader(prog_P0, fs);
304
	
303
	
305
	// Link the program object and print out the info log
304
	// Link the program object and print out the info log
306
	glLinkProgram(prog_P0);
305
	glLinkProgram(prog_P0);
307
	print_glsl_program_log(prog_P0);
306
	print_glsl_program_log(prog_P0);
308
	
307
	
309
	// Install program object as part of current state
308
	// Install program object as part of current state
310
	glUseProgram(0);
309
	glUseProgram(0);
311
	
310
	
312
	CreateCVar("display.harmonics.eigenvalue",0);
311
	CreateCVar("display.harmonics.eigenvalue",0);
313
	CreateCVar("display.harmonics.eigenvalue2",0);
312
	CreateCVar("display.harmonics.eigenvalue2",0);
314
	CreateCVar("display.harmonics.highlight",1);
313
	CreateCVar("display.harmonics.highlight",1);
315
	CreateCVar("display.harmonics.diffuse",1);
314
	CreateCVar("display.harmonics.diffuse",1);
316
 
315
 
317
}
316
}
318
 
317