Subversion Repositories gelsvn

Rev

Rev 145 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 145 Rev 157
Line 1... Line 1...
1
#include <fstream>
1
#include <fstream>
-
 
2
#include "GLGraphics/gel_glut.h"
2
#include "Graphics/GLViewController.h"
3
#include "GLGraphics/GLViewController.h"
3
 
4
 
4
#include "Graphics/gel_glut.h"
-
 
5
#include <glui.h>
-
 
6
#include <stack>
5
#include <stack>
7
#include <iostream>
6
#include <iostream>
8
#include "Util/Timer.h"
7
#include "Util/Timer.h"
9
#include "Util/ResourceManager.h"
8
#include "Util/ResourceManager.h"
10
 
9
 
Line 183... Line 182...
183
	glutSwapBuffers();
182
	glutSwapBuffers();
184
}
183
}
185
 
184
 
186
void animate() 
185
void animate() 
187
{
186
{
188
	if ( glutGetWindow() != main_window ) 
-
 
189
		glutSetWindow(main_window);  
-
 
190
}
-
 
191
 
-
 
192
void timer(int) 
-
 
193
{
-
 
194
	if ( glutGetWindow() != main_window ) 
-
 
195
		glutSetWindow(main_window);  
-
 
196
	view_ctrl->try_spin();
-
 
197
	glutPostRedisplay();
187
	glutPostRedisplay();
198
	glutTimerFunc(20, timer, 0); 
-
 
199
}
188
}
200
 
189
 
201
 
-
 
202
void mouse(int button, int state, int x, int y) 
190
void mouse(int button, int state, int x, int y) 
203
{
191
{
204
	Vec2i pos(x,y);
192
	Vec2i pos(x,y);
205
	if (state==GLUT_DOWN) 
193
	if (state==GLUT_DOWN) 
206
		{
194
		{
Line 252... Line 240...
252
	glutDisplayFunc(display);
240
	glutDisplayFunc(display);
253
	glutKeyboardFunc(keyboard);
241
	glutKeyboardFunc(keyboard);
254
	glutReshapeFunc(reshape);
242
	glutReshapeFunc(reshape);
255
	glutMouseFunc(mouse);
243
	glutMouseFunc(mouse);
256
	glutMotionFunc(motion);
244
	glutMotionFunc(motion);
-
 
245
	glutIdleFunc(animate);
257
 
246
 
258
	Vec3f c(0.152875, -4.92971, 0.04389);
247
	Vec3f c(0.152875, -4.92971, 0.04389);
259
	float r = 2.14036;
248
	float r = 2.14036;
260
	
249
	
261
	my_mesh->get_bsphere(c,r);
250
	my_mesh->get_bsphere(c,r);
Line 272... Line 261...
272
	glEnable(GL_DEPTH_TEST);
261
	glEnable(GL_DEPTH_TEST);
273
	glEnable(GL_NORMALIZE);
262
	glEnable(GL_NORMALIZE);
274
	glEnable(GL_LIGHTING);
263
	glEnable(GL_LIGHTING);
275
	glEnable(GL_LIGHT0);
264
	glEnable(GL_LIGHT0);
276
 
265
 
277
	// --------------------------------------------------
-
 
278
	// creat glui interface.
-
 
279
 
-
 
280
	GLUI *glui = GLUI_Master.create_glui( "GLUI" );
-
 
281
	glui->add_checkbox( "Light follows cam ", &light_follows_cam );
-
 
282
  glui->add_rotation( "Light direction", lights_rot );
-
 
283
	glui->set_main_gfx_window( main_window );
-
 
284
	GLUI_Master.set_glutIdleFunc( animate ); 
-
 
285
	glutTimerFunc(20, timer, 0); 
-
 
286
 
-
 
287
 
-
 
288
	glutMainLoop();
266
	glutMainLoop();
289
	return 0;
267
	return 0;
290
}
268
}
291
 
269