예제 #1
0
int main(int argc, char **argv)
{
    int q;
    int start, end;

    printf("Initializing EGL...\n");

    if(!init_gl_surface())
    {
        printf("GL initialisation failed - exiting\n");
        return 0;
    }

    init_scene();

    create_texture();

    printf("Start test...\n");

    render(argc==2 ? atoi(argv[1]) : ITERATIONS);

    free_gl_surface();

    return 0;
}
int main(){
  int x;
  G_init_graphics(600,600);
  int i;
  char prefix[100], filename[100];
  strncpy(prefix, "tetrahedron", 100);
  scanf("%s", textureName);

  //tetrahedron0000
  //14
  for(i=0; i < 73; i++){
    printf("%d\n", i);
    init_scene(i);
    sprintf(filename, "%s%04d", prefix, i);
    filename[15] = '.';
    filename[16] = 'x';
    filename[17] = 'w';
    filename[18] = 'd';
    G_save_image_to_file(filename);
    G_wait_key();
    G_rgb(1,1,1);
    G_clear();
  }
//main->init scene->draw
}
예제 #3
0
파일: game_srv.c 프로젝트: a1406/txgg
int init_all_objs(int resume)
{
	if (resume) {
		if (resume_thing_obj() != 0) {
			return (-1); 		
		}
		if (resume_container() != 0) {
			return (-2);		
		}
		if (resume_scene() != 0) {
			return (-4); 		
		}
		if (resume_instance() != 0) {
			return (-5); 		
		}
		if (resume_role() != 0) {
			return (-6); 		
		}
	} else {
		init_thing_obj();
		init_container();
		init_role();
		init_scene();
		init_instance();
	}
	return (0);
}
int main(int argc, char **argv) 
{  
	// initialisation  des paramètres de GLUT en fonction
	// des arguments sur la ligne de commande
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

	// définition et création de la fenêtre graphique
	glutInitWindowSize(WIDTH, HEIGHT);
	glutInitWindowPosition(0, 0);
	glutCreateWindow("Primitives graphiques");

	// initialisation de OpenGL et de la scène
	initGL();  
	init_scene();

	// choix des procédures de callback pour 
	// le tracé graphique
	glutDisplayFunc(&window_display);
	// le redimensionnement de la fenêtre
	glutReshapeFunc(&window_reshape);
	// la gestion des événements clavier
	glutKeyboardFunc(&window_key);
	glutIdleFunc(&window_idle);
	// la boucle prinicipale de gestion des événements utilisateur
	glutMainLoop();  

	return 1;
}
예제 #5
0
//Set the render world
void world() {
	init_scene();
	samples[SAMPLE_SIZE*SAMPLE_SIZE*2] = g_frame % (SAMPLE_SIZE * SAMPLE_SIZE);
	generate_geometries(geometries);
	float viewplane_dis = 1.0;
	float viewplane_scale[] = {g_Width / 480.0, g_Height / 480.0};
	int num_point_light = lights.point_light_pos.size(), num_direct_light = lights.direct_light_dir.size();
	data_to_uniform(&camera[0], 3, 1, "camera");
	data_to_uniform(&camera_up[0], 3, 1, "camera_up");
	data_to_uniform(&camera_lookat[0], 3, 1, "camera_lookat");
	data_to_uniform(&viewplane_dis, 1, 1, "viewplane_dis");
	data_to_uniform(viewplane_scale, 2, 1, "viewplane_scale");
	int_to_uniform(num_triangles, "num_triangles");
	data_to_uniform((float*)lights.point_light_pos.data(), 3, num_point_light, "point_lights");
	data_to_uniform((float*)lights.direct_light_dir.data(), 3, num_direct_light, "direct_lights");
	data_to_uniform((float*)lights.point_light_color.data(), 3, num_point_light, "point_lights_color");
	data_to_uniform((float*)lights.direct_light_color.data(), 3, num_direct_light, "direct_lights_color");
	int_to_uniform(num_point_light, "num_point_light");
	int_to_uniform(num_direct_light, "num_direct_light");
	data_to_uniform((float*)&(lights.ambient), 3, 1, "ambient");
	glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, mesh_texture);
	int_to_uniform(0, "meshSampler");
	glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, normal_texture);
	int_to_uniform(1, "normalSampler");
	glActiveTexture(GL_TEXTURE2);
    glBindTexture(GL_TEXTURE_2D, material_texture);
	int_to_uniform(2, "materialSampler");
	glActiveTexture(GL_TEXTURE3);
    glBindTexture(GL_TEXTURE_2D, tex_texture);
	int_to_uniform(3, "texSampler");
	glActiveTexture(GL_TEXTURE4);
    glBindTexture(GL_TEXTURE_1D, index_texture);
	int_to_uniform(4, "indexSampler");
	glActiveTexture(GL_TEXTURE5);
    glBindTexture(GL_TEXTURE_2D, bvh_texture);
	int_to_uniform(5, "bvhSampler");	
	glActiveTexture(GL_TEXTURE6);
    glBindTexture(GL_TEXTURE_1D, sampler_texture);
	int_to_uniform(6, "samples");
	int* tex_id = new int[TexManager::texResource.size()];
	for (int i = 0; i < TexManager::texResource.size(); ++i) {
		tex_id[i] = 7 + i;
		glActiveTexture(GL_TEXTURE0 + 7 + i);
		glBindTexture(GL_TEXTURE_2D, TexManager::texResource[i]);
	}
	data_to_uniform(tex_id, 1, TexManager::texResource.size(), "renderSampler");
//	int_to_uniform(7, "renderSampler");
	int_to_uniform(num_object, "num_object");
	int_to_uniform(num_bvh, "num_bvh");
	int_to_uniform(use_bvh, "use_bvh");
	int_to_uniform(use_path, "use_path");
	delete[] tex_id;
//	data_to_uniform(tex, 1, 1, "renderSampler");
}
예제 #6
0
t_wid		*init_file(t_wid *wid)
{
  int		fd;
  char		*link;

  if ((fd = open("./resource/save", O_RDONLY)) == -1)
    error_gtk("error : ./resource/save don't open");
  link = get_next_line(fd);
  if (link[0] != '1' && link[1] != 0)
    init_scene(&wid->data, link);
  return (wid);
}
 void onInit()
 {
   sys::info << "app::COGLDev45AmbientOcclusionApp::onInit() " << sys::endl;
   
   init_programs();
   
   init_scene();
   
   init_renderers();
   
   init_controllers();
 }
예제 #8
0
        void queue_debug::init_gui()
        {
            auto* layout = new QGridLayout{this};
            setLayout(layout);

            _name = new QLabel{_name_s.c_str()};
            layout->addWidget(_name, 0,0,2,1);

            _in_graph = new QGraphicsView;
            _out_graph = new QGraphicsView;

            layout->addWidget(_in_graph, 0,1,1,3);
            layout->addWidget(_out_graph, 1,1,1,3);

            init_scene(*_in_graph);
            init_scene(*_out_graph);

            auto *t = new QTimer(this);
            connect(t, SIGNAL(timeout()), this, SLOT(update_graph()));
            t->start(UPDATE_GRAPH);
        }
int main(int argc, char **argv) 
{
	
	m = OFFManager::meshLoader("bunny.off");

	std::cout << "nb vertex : " << m.nbvertex() << std::endl;
	std::cout << "nb face : " << m.nbface()/3 << std::endl;

	Aretes aretes = Aretes(m);

	std::cout << "nb aretes : " << aretes.getNbAretes() << std::endl;
	std::cout << "nb aretes par faces : 3" << std::endl;

	float nbMin, nbMax;

	aretes.getNbAretesBySommet(nbMin, nbMax);

	std::cout << "nb aretes par sommet : min = " << nbMin << "; max = " << nbMax << std::endl;

	std::cout << "nb aretes partage par 0 ou 1 sommet : " << aretes.getNbAretesBy0Et1Face(m) << std::endl;

	// initialisation  des paramètres de GLUT en fonction
	// des arguments sur la ligne de commande
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

	// définition et création de la fenêtre graphique
	glutInitWindowSize(WIDTH, HEIGHT);
	glutInitWindowPosition(0, 0);
	glutCreateWindow("Primitives graphiques");

	// initialisation de OpenGL et de la scène
	initGL();  
	init_scene();

	// choix des procédures de callback pour 
	// le tracé graphique
	glutDisplayFunc(&window_display);
	// le redimensionnement de la fenêtre
	glutReshapeFunc(&window_reshape);
	// la gestion des événements clavier
	glutKeyboardFunc(&window_key);
	glutIdleFunc(&window_idle);
	// la boucle prinicipale de gestion des événements utilisateur
	glutMainLoop();

    return 0;

	//OFFManager::meshWriter("test.off", m);
}
예제 #10
0
Engine::Engine(GLFWwindow* window)
        : window(window), physics(new Physics(60)) {

    glfwSetWindowTitle(window, "gl1");
    glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
    glDepthFunc(GL_LEQUAL);
    glDepthRange(0.0, 1.0);
    glEnable(GL_CULL_FACE);
    glFrontFace(GL_CW);

    init_scene();
}
예제 #11
0
int main()
{
	t_env	env;
	t_scene	*scene;
	t_light *light;

	scene = NULL;
	light = NULL;
	init_env(&env);
	init_scene(&scene, &light);
	scan_scene(&env, scene, light);
	mlx_hook(env.win, 2, 4, key_hook, &env);
	mlx_loop(env.mlx);
	return (0);
}
예제 #12
0
파일: main.c 프로젝트: solmir/projet42
int			main(int ac, char **av)
{
	GLFWwindow		*win;
	t_env			e;
	t_cam			c;

	init_key_binding();
	init_scene(&e);
	init_cam(&c, &e);
	if (!glfwInit())
		exit(EXIT_FAILURE);
	glfwSetErrorCallback(error_callback);
	if (!(win = glfwCreateWindow(WIN_W, WIN_H, "visualisatron 2000",
					NULL, NULL)))
		ft_exit("failed to open window !");
	e.map = malloc(4096);
	e.player_number = 4;
	e.memory_size = 4096;
	e.grid_width = 64;
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
	glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
	glfwWindowHint(GLFW_SAMPLES, 1);
	glfwSetFramebufferSizeCallback(win, framebuffer_size_callback);
	glfwSetKeyCallback(win, key_callback);
	glfwSetWindowSizeCallback(win, window_size_callback);
	glfwMakeContextCurrent(win);
	glfwSetCursorPosCallback(win, cursor_pos_callback);
	glfwSetMouseButtonCallback(win, mouse_click_callback);
	glfwSetScrollCallback(win, mouse_scroll_callback);
	glfwSwapInterval(1);
	glEnable(GL_CULL_FACE);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_TEXTURE_2D);
	glfwShowWindow(win);
	init_msaa();
//	printf("%s\n", glGetString( GL_EXTENSIONS ) );
	while (!glfwWindowShouldClose(win))
		main_loop(win, &e);
	glfwDestroyWindow(win);
	glfwTerminate();
	return (0);
	(void)ac;
	(void)av;
}
static scene_t
create_sphereflake_scene(int recursion_limit)
{
	scene_t scene;
	Vec3 color;
	sphere_t* sphere;

	init_scene(&scene);
	add_light(&scene, 2, 5, 0, 0.92, 0.76, 0.771);
	add_light(&scene, -5, 3, -5, 0.96, 0.93, 0.88);
	int max_sphere_count = 2 + powl(6, recursion_limit + 2);
	scene.spheres = realloc(scene.spheres,
		max_sphere_count*sizeof(sphere_t));
	if (!scene.spheres)
	{
		fprintf(stderr, "Failed to get memory for sphereflake.  aborting.\n");
		exit(-1);
	}

	//    sphere = &(scene.spheres[0]);
	//    set( sphere->org, -0.5, -1.0, 0 );
	//    sphere->rad = 0.75;
	//    set( color, 0.85, 0.25, 0.25 );
	//    copy( sphere->color, color );
	//    sphere->shader = mirror_shader;


	/* center sphere is special, child inherent shader and color */
	sphere = &(scene.spheres[0]);
	scene.sphere_count++;
	set(sphere->org, 0, -1, 0);
	sphere->rad = 0.75;
	set(color, 0.75, 0.75, 0.75);
	copy(sphere->color, color);
	sphere->shader = mirror_shader;
	recursive_add_sphereflake(&scene,
		0, /* parent is the first sphere */
		-1, /* -1 means no dir, make all children */
		1, /* next free sphere index */
		2, /* starting dir */
		0, /* starting recursion level */
		recursion_limit);

	return scene;
}
예제 #14
0
파일: init.c 프로젝트: Strade288/42
t_env			*init_env(char *path)
{
	t_env		*e;

	if (!(e = (t_env *)malloc(sizeof(t_env))))
		ft_error(1, NULL, "Not enough memory.\n");
	if (!(e->mlx = mlx_init()))
		ft_error(1, e, "Mlx fail init.\n");
	if (!(e->win = mlx_new_window(e->mlx, WIDTH, HEIGHT, NAME)))
		ft_error(1, e, "Win fail init.\n");
	if (!init_scene(e, path))
		ft_error(1, e, "Wrong file format.\n");
	e->x_ratio = 0.5 / (double)WIDTH;
	e->y_ratio = 0.35 / (double)HEIGHT;
	init_events(e);
	init_types(e);
	init_screen(e->mlx, &e->screen, WIDTH, HEIGHT);
	return (e);
}
예제 #15
0
파일: test.c 프로젝트: Alakartes/opengl
int main(int argc, char **argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);

    glutInitWindowSize(windowWidth, windowHeight);
    glutInitWindowPosition(0, 0);
    glutCreateWindow("openGL ET3");

    initGL();
    init_scene();

    glutDisplayFunc(&window_display);
    glutReshapeFunc(&window_reshape);
    glutKeyboardFunc(&window_key);
    glutTimerFunc(latence, &window_timer, Step);

    glutMainLoop();

    return 1;
}
예제 #16
0
void app_Scene::on_open()
{
	if(!glew_init())
		die("GLEW init fail");
	
	if(!gl_init())
		die("GL init fail");
	
	if(!load_resources())
		die("Couldn't load resources");

	if(!init_scene())
		die("Couldn't init scene");
	
	//Initial resize ( window init kinda )
	{
		int w, h;
		glfwGetWindowSize(this->handle(), &w, &h);
		this->on_resize(w,h);
	}
}
예제 #17
0
파일: common.c 프로젝트: piotrm0/progs
int main(int argc, char** argv) {
  glutInit(&argc, argv);
  //glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
  glutInitWindowSize(w_width, w_height);
  glutInitWindowPosition (100, 100);

  glutCreateWindow(argv[0]);

  init_gl();
  init_scene();

  glutDisplayFunc(draw_gl);
  glutReshapeFunc(resize_gl);
  //  glutIdleFunc(idle_gl);
  glutKeyboardFunc(handle_keyboard);
  glutSpecialFunc(handle_special);

  glutMainLoop();

  return 0;
}
예제 #18
0
int main(int argc, char *argv[]) {
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH |
		GLUT_STENCIL);
	if((argc > 1) && (strcmpi(argv[1], "--helmet") == 0)) {
		/*left eye*/
		glutInitWindowPosition(0,0);
		glutInitWindowSize(640, 480);
		left_eye = glutCreateWindow("Escher World - Left Eye");

		glutSetWindow(left_eye);
		set_window_size(640, 480);
		glutDisplayFunc(displayleft);
		glutKeyboardFunc(keyfunc);
		glutMouseFunc(mouse_button);
		glutPassiveMotionFunc(passive_mouse_motion);
		glutMotionFunc(passive_mouse_motion);
		glutReshapeFunc(set_window_size);
/*		glutTimerFunc(10,child,1);*/

		/* right eye */
		glutInitWindowPosition(641,0);
		glutInitWindowSize(640, 480);
		right_eye = glutCreateWindow("Escher World - Right Eye");

		glutSetWindow(right_eye);
		set_window_size(640, 480);
		glutDisplayFunc(displayright);
		glutKeyboardFunc(keyfunc);
		glutMouseFunc(mouse_button);
		glutPassiveMotionFunc(passive_mouse_motion);
		glutMotionFunc(passive_mouse_motion);
		glutReshapeFunc(set_window_size);

		glutSetWindow(left_eye);
		create_menus();
		init();
		/* Initialize the scene */
		init_scene(FILENAME);

		glutSetWindow(right_eye);
		create_menus();
		create_menus();
		init();
		/* Initialize the scene */
		init_scene(FILENAME);

#ifdef USE_HELMET
/*		main_helmet();
		signal(SIGUSR1, cleanup);
*/		birdinit();
/*		glutTimerFunc(10,child,1);*/
#endif

	} else {
		glutInitWindowPosition(64,64);

		glutInitWindowSize(768, 832);
		glut_window = glutCreateWindow("Escher World");

		glutSetWindow(glut_window);
		set_window_size(768, 832);
		helmet = !helmet;
		glutDisplayFunc(displaymid);
		glutKeyboardFunc(keyfunc);
		glutMouseFunc(mouse_button);
		glutPassiveMotionFunc(passive_mouse_motion);
		glutMotionFunc(passive_mouse_motion);
		glutReshapeFunc(set_window_size);
		create_menus();
		init();
		/* Initialize the scene */
		init_scene(FILENAME);
	}

	glutMainLoop();

	return 0;
}
예제 #19
0
파일: rtv1.c 프로젝트: ebaudet/Raytracer
void	rtv1(void)
{
	rand_init();
	init_scene();
	eb_mlx();
}
예제 #20
0
파일: sdl_disk.c 프로젝트: cnvogelg/glues
int main(int argc, char** argv)
{
   int status;
   SDL_WindowID window;
   SDL_GLContext glcontext=NULL;
   SDL_Event event;
   SDL_bool done=SDL_FALSE;

   status=SDL_Init(SDL_INIT_VIDEO);
   if (status<0)
   {
      fprintf(stderr, "Can't init default SDL video driver: %s\n", SDL_GetError());
      exit(-1);
   }

   /* Select first display */
   status=SDL_SelectVideoDisplay(0);
   if (status<0)
   {
      fprintf(stderr, "Can't attach to first display: %s\n", SDL_GetError());
      exit(-1);
   }

   window=SDL_CreateWindow("SDL GLU ES Disk test",
      SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
      WINDOW_WIDTH, WINDOW_HEIGHT,
      SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
   if (window==0)
   {
      fprintf(stderr, "Can't create window: %s\n", SDL_GetError());
      exit(-1);
   }

   glcontext=SDL_GL_CreateContext(window);
   if (glcontext==NULL)
   {
      fprintf(stderr, "Can't create OpenGL ES context: %s\n", SDL_GetError());
      exit(-1);
   }

   status=SDL_GL_MakeCurrent(window, glcontext);
   if (status<0)
   {
      fprintf(stderr, "Can't set current OpenGL ES context: %s\n", SDL_GetError());
      exit(-1);
   }

   init_scene(WINDOW_WIDTH, WINDOW_HEIGHT);

   do {
      /* handle the events in the queue */
      while (SDL_PollEvent(&event))
      {
         switch(event.type)
         {
            case SDL_WINDOWEVENT:
                 switch (event.window.event)
                 {
                    case SDL_WINDOWEVENT_CLOSE:
                         done=SDL_TRUE;
                         break;
                 }
                 break;
            case SDL_KEYDOWN:
                 switch (event.key.keysym.sym)
                 {
                    case SDLK_ESCAPE:
                         done=SDL_TRUE;
                         break;
                 }
                 break;
            case SDL_QUIT:
                 done=SDL_TRUE;
                 break;
         }
      }

      if (done==SDL_TRUE)
      {
         break;
      }

      render_scene();
      SDL_GL_SwapWindow(window);
   } while(1);

   SDL_GL_DeleteContext(glcontext);
   SDL_DestroyWindow(window);
   SDL_Quit();

   return 0;
}
예제 #21
0
//
// FUNCTION: WndProc (HWND, UINT, WPARAM, LPARAM)
//
// PURPOSE: Process the message in the main window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - draw the main window
// WM_DESTROY - send a message to exit and return
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{

	int cbIndex;

	static scene sceneSettings = init_scene(hWnd);
	params parameters;

	PAINTSTRUCT ps;
	HDC hdc;
	
	HWND bufHWND;
	TCHAR buf[5];

	switch (message)
	{
	case WM_COMMAND:
	{
		int wmId = LOWORD(wParam);
		switch (wmId)
		{
		case ID_BUTTON_DRAW_ELLIPSE:
			cbIndex = getCurrentItem(GetDlgItem(hWnd, ID_COMBO_ELLIPSE));

			bufHWND = GetDlgItem(hWnd, ID_EDIT_ELLIPSE_CENTER_X);
			GetWindowText(bufHWND, buf, 5);
			parameters.centerX = _wtoi(buf);

			bufHWND = GetDlgItem(hWnd, ID_EDIT_ELLIPSE_CENTER_Y);
			GetWindowText(bufHWND, buf, 5);
			parameters.centerY = _wtoi(buf);

			bufHWND = GetDlgItem(hWnd, ID_EDIT_ELLIPSE_HEIGHT);
			GetWindowText(bufHWND, buf, 5);
			parameters.height = _wtoi(buf);

			bufHWND = GetDlgItem(hWnd, ID_EDIT_ELLIPSE_WIDTH);
			GetWindowText(bufHWND, buf, 5);
			parameters.width = _wtoi(buf);

			draw(ELLIPSE, parameters, cbIndex, sceneSettings);
			break;
		case ID_BUTTON_DRAW_CIRCLE:
			cbIndex = getCurrentItem(GetDlgItem(hWnd, ID_COMBO_CIRCLE));

			bufHWND = GetDlgItem(hWnd, ID_EDIT_CIRCLE_CENTER_X);
			GetWindowText(bufHWND, buf, 5);
			parameters.centerX = _wtoi(buf);

			bufHWND = GetDlgItem(hWnd, ID_EDIT_CIRCLE_CENTER_Y);
			GetWindowText(bufHWND, buf, 5);
			parameters.centerY = _wtoi(buf);

			bufHWND = GetDlgItem(hWnd, ID_EDIT_CIRCLE_RADIUS);
			GetWindowText(bufHWND, buf, 5);
			parameters.radiusMin = _wtoi(buf);
			parameters.radiusMax = _wtoi(buf);

			draw(CIRCLE, parameters, cbIndex, sceneSettings);
			break;
		case ID_BUTTON_DRAW_SPEKTRE:
			cbIndex = getCurrentItem(GetDlgItem(hWnd, ID_COMBO_SPEKTRE));

			bufHWND = GetDlgItem(hWnd, ID_EDIT_SPEKTRE_RADIUS_MIN);
			GetWindowText(bufHWND, buf, 5);
			parameters.radiusMin = _wtoi(buf);

			bufHWND = GetDlgItem(hWnd, ID_EDIT_SPEKTRE_RADIUS_MAX);
			GetWindowText(bufHWND, buf, 5);
			parameters.radiusMax = _wtoi(buf);

			bufHWND = GetDlgItem(hWnd, ID_EDIT_SPEKTRE_RADIUS_STEP);
			GetWindowText(bufHWND, buf, 5);
			parameters.radiusStep = _wtoi(buf);

			draw(SPEKTRE, parameters, cbIndex, sceneSettings);
			break;
		case ID_BUTTON_CLEAR:
			draw_scene(sceneSettings);
			break;
		case ID_BUTTON_LCOLOR:
			change_color(&sceneSettings, TRUE);
			break;
		case ID_BUTTON_BCOLOR:
			change_color(&sceneSettings, FALSE);
			break;
		case IDM_ABOUT:
			DialogBoxW(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}

		SetFocus(hWnd);
	}
	break;
	case WM_PAINT:
	{
		hdc = BeginPaint(hWnd, &ps);
		draw_scene(sceneSettings);
		init_colorpick(sceneSettings);
		init_text(sceneSettings);
		EndPaint(hWnd, &ps);
	}
	break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
예제 #22
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine, int nCmdShow)
{
   int i;

   // Windows variables
   HWND hWnd=0;
   HDC  hDC=0;

   // EGL variables
   EGLDisplay eglDisplay=0;
   EGLConfig  eglConfig=0;
   EGLSurface eglSurface=0;
   EGLContext eglContext=0;
   NativeWindowType eglWindow=0;
   EGLint pi32ConfigAttribs[128];
   unsigned int nWidth;
   unsigned int nHeight;
   ATOM registerClass;
   RECT sRect;
   EGLint iMajorVersion, iMinorVersion;
   int iConfigs;

   /*
      Step 0 - Create a NativeWindowType that we can use for OpenGL ES output
   */

   // Register the windows class
   WNDCLASS sWC;

   sWC.style=CS_HREDRAW | CS_VREDRAW;
   sWC.lpfnWndProc=WndProc;
   sWC.cbClsExtra=0;
   sWC.cbWndExtra=0;
   sWC.hInstance=hInstance;
   sWC.hIcon=0;
   sWC.hCursor=0;
   sWC.lpszMenuName=0;
   sWC.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
   sWC.lpszClassName=WINDOW_CLASS;

   nWidth=WINDOW_WIDTH;
   nHeight=WINDOW_HEIGHT;

   registerClass=RegisterClass(&sWC);
   if (!registerClass)
   {
      MessageBox(0, _T("Failed to register the window class"), _T("Error"), MB_OK | MB_ICONEXCLAMATION);
   }

   // Create the eglWindow
   SetRect(&sRect, 0, 0, nWidth, nHeight);
   AdjustWindowRectEx(&sRect, WS_CAPTION | WS_SYSMENU, 0, 0);
   hWnd=CreateWindow(WINDOW_CLASS, _T("GLU ES Tesselation test"), WS_VISIBLE | WS_SYSMENU, 0, 0, nWidth, nHeight, NULL, NULL, hInstance, NULL);
   eglWindow=hWnd;

   // Get the associated device context
   hDC=GetDC(hWnd);
   if (!hDC)
   {
      MessageBox(0, _T("Failed to create the device context"), _T("Error"), MB_OK|MB_ICONEXCLAMATION);
      goto cleanup;
   }

   /*
      Step 1 - Get the default display.
      EGL uses the concept of a "display" which in most environments
      corresponds to a single physical screen. Since we usually want
      to draw to the main screen or only have a single screen to begin
      with, we let EGL pick the default display.
      Querying other displays is platform specific.
   */
   eglDisplay=eglGetDisplay((NativeDisplayType)hDC);

   if(eglDisplay==EGL_NO_DISPLAY)
   {
      eglDisplay=eglGetDisplay((NativeDisplayType)EGL_DEFAULT_DISPLAY);
   }

   /*
      Step 2 - Initialize EGL.
      EGL has to be initialized with the display obtained in the
      previous step. We cannot use other EGL functions except
      eglGetDisplay and eglGetError before eglInitialize has been
      called.
      If we're not interested in the EGL version number we can just
      pass NULL for the second and third parameters.
   */

   if (!eglInitialize(eglDisplay, &iMajorVersion, &iMinorVersion))
   {
      MessageBox(0, _T("eglInitialize() failed."), _T("Error"), MB_OK | MB_ICONEXCLAMATION);
      goto cleanup;
   }

   /*
      Step 3 - Specify the required configuration attributes.
      An EGL "configuration" describes the pixel format and type of
      surfaces that can be used for drawing.
      For now we just want to use a 16 bit RGB surface that is a
      Window surface, i.e. it will be visible on screen. The list
      has to contain key/value pairs, terminated with EGL_NONE.
   */
   i=0;

   pi32ConfigAttribs[i++]=EGL_RED_SIZE;
   pi32ConfigAttribs[i++]=5;
   pi32ConfigAttribs[i++]=EGL_GREEN_SIZE;
   pi32ConfigAttribs[i++]=6;
   pi32ConfigAttribs[i++]=EGL_BLUE_SIZE;
   pi32ConfigAttribs[i++]=5;
   pi32ConfigAttribs[i++]=EGL_ALPHA_SIZE;
   pi32ConfigAttribs[i++]=0;
   pi32ConfigAttribs[i++]=EGL_DEPTH_SIZE;
   pi32ConfigAttribs[i++]=16;
   pi32ConfigAttribs[i++]=EGL_SURFACE_TYPE;
   pi32ConfigAttribs[i++]=EGL_WINDOW_BIT;
   pi32ConfigAttribs[i++]=EGL_NONE;

   /*
      Step 4 - Find a config that matches all requirements.
      eglChooseConfig provides a list of all available configurations
      that meet or exceed the requirements given as the second
      argument. In most cases we just want the first config that meets
      all criteria, so we can limit the number of configs returned to 1.
   */
   if (!eglChooseConfig(eglDisplay, pi32ConfigAttribs, &eglConfig, 1, &iConfigs) || (iConfigs != 1))
   {
      MessageBox(0, _T("eglChooseConfig() failed."), _T("Error"), MB_OK|MB_ICONEXCLAMATION);
      goto cleanup;
   }

   /*
      Step 5 - Create a surface to draw to.
      Use the config picked in the previous step and the native window
      handle when available to create a window surface. A window surface
      is one that will be visible on screen inside the native display (or
      fullscreen if there is no windowing system).
      Pixmaps and pbuffers are surfaces which only exist in off-screen
      memory.
   */
   eglSurface=eglCreateWindowSurface(eglDisplay, eglConfig, eglWindow, NULL);

   if (eglSurface==EGL_NO_SURFACE)
   {
      eglGetError(); // Clear error
      eglSurface=eglCreateWindowSurface(eglDisplay, eglConfig, NULL, NULL);
   }

   if (!TestEGLError(hWnd, "eglCreateWindowSurface"))
   {
      goto cleanup;
   }

   /*
      Step 6 - Create a context.
      EGL has to create a context for OpenGL ES. Our OpenGL ES resources
      like textures will only be valid inside this context
      (or shared contexts)
   */
   eglContext=eglCreateContext(eglDisplay, eglConfig, NULL, NULL);
   if (!TestEGLError(hWnd, "eglCreateContext"))
   {
      goto cleanup;
   }

   /*
      Step 7 - Bind the context to the current thread and use our
      window surface for drawing and reading.
      Contexts are bound to a thread. This means you don't have to
      worry about other threads and processes interfering with your
      OpenGL ES application.
      We need to specify a surface that will be the target of all
      subsequent drawing operations, and one that will be the source
      of read operations. They can be the same surface.
   */
   eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
   if (!TestEGLError(hWnd, "eglMakeCurrent"))
   {
      goto cleanup;
   }

   /* Initialize scene */
   init_scene(WINDOW_WIDTH, WINDOW_HEIGHT);

   /* Render stuff */
   do {
      MSG msg;

	  render_scene();
      glFinish();
      eglWaitGL();
      eglSwapBuffers(eglDisplay, eglSurface);
	  if (done)
	  {
         break;
	  }

      PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE);
      TranslateMessage(&msg);
      DispatchMessage(&msg);

   } while(1);


   /*
      Step 8 - Terminate OpenGL ES and destroy the window (if present).
      eglTerminate takes care of destroying any context or surface created
      with this display, so we don't need to call eglDestroySurface or
      eglDestroyContext here.
   */
cleanup:
   eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
   eglTerminate(eglDisplay);

   /*
      Step 9 - Destroy the eglWindow.
      Again, this is platform specific and delegated to a separate function.
   */

   // Release the device context
   if (hDC)
   {
      ReleaseDC(hWnd, hDC);
   }

   // Destroy the eglWindow
   if (hWnd)
   {
      DestroyWindow(hWnd);
   }

   return 0;
}
예제 #23
0
int main(int argc, char** argv)
{
    result_t r;
    memset(g_obj_barrels, 0x00, sizeof(g_obj_barrels));

    /* Init core library */
    r = core_init(CORE_INIT_ALL);

    /* After core init, you can set logging options */
    log_outputconsole(TRUE);
    set_logfile();

    /* load config file (json) */
    init_params* params = app_config_default();
    if (params == NULL) {
        err_sendtolog(FALSE);
        core_release(FALSE);
        return -1;
    }

    /* Add our stuff to init params
     * Engine's data directory must be changed
     */
    params->flags |= (ENG_FLAG_CONSOLE | ENG_FLAG_DEV);

    /* Initialize application (graphics device and rendering window)
     * Application name will also, be the name of the main window */
    r = app_init(APP_NAME, params);
    if (IS_FAIL(r)) {
        err_sendtolog(FALSE);
        core_release(FALSE);
        app_config_unload(params);
        return -1;
    }

    /* Initialize engine */
    r = eng_init(params);

    /* init params isn't needed anymore */
    app_config_unload(params);
    if (IS_FAIL(r)) {
        err_sendtolog(FALSE);
        eng_release();
        app_release();
        core_release(TRUE);
        return -1;
    }

    if (!init_scene())  {
        err_sendtolog(FALSE);
        eng_release();
        app_release();
        core_release(TRUE);
        return -1;
    }

    /* Set application callbacks */
    app_window_setupdatefn(update_callback);
    app_window_setkeypressfn(keypress_callback);
    app_window_setactivefn(activate_callback);
    app_window_setresizefn(resize_callback);
    gfx_set_debug_renderfunc(debug_view_callback);

    /* Initialize ok: show the main window */
    app_window_show();

    /* Enter message loop and update engine */
    app_window_run();

    /* cleanup */
    release_scene();
    eng_release();
    app_release();
    core_release(TRUE);
    return 0;
}
예제 #24
0
파일: sphere.c 프로젝트: nbasakuragi/glues
int main(int argc, char** argv)
{
    gf_3d_target_t      target;
    gf_display_t        gf_disp;
    EGLConfig           config;
    EGLContext          econtext;
    EGLint              num_config;
    gf_dev_info_t       info;
    gf_layer_info_t     linfo;
    gf_display_info_t   disp_info;
    GLuint              width, height;
    GLuint              it;

    /* initialize the graphics device */
    if (gf_dev_attach(&gfdev, NULL, &info)!=GF_ERR_OK)
    {
        perror("gf_dev_attach()");
        return -1;
    }

    /* Setup the layer we will use */
    if (gf_display_attach(&gf_disp, gfdev, 0, &disp_info)!=GF_ERR_OK)
    {
        fprintf(stderr, "gf_display_attach() failed\n");
        return -1;
    }

    width=disp_info.xres;
    height=disp_info.yres;

    layer_idx=disp_info.main_layer_index;

    /* get an EGL display connection */
    display=eglGetDisplay(gfdev);
    if (display==EGL_NO_DISPLAY)
    {
        fprintf(stderr, "eglGetDisplay() failed\n");
        return -1;
    }

    if (gf_layer_attach(&layer, gf_disp, layer_idx, 0)!=GF_ERR_OK)
    {
        fprintf(stderr, "gf_layer_attach() failed\n");
        return -1;
    }

    /* initialize the EGL display connection */
    if (eglInitialize(display, NULL, NULL)!=EGL_TRUE)
    {
        fprintf(stderr, "eglInitialize: error 0x%x\n", eglGetError());
        return -1;
    }

    for (it=0;; it++)
    {
        /* Walk through all possible pixel formats for this layer */
        if (gf_layer_query(layer, it, &linfo)==-1)
        {
            fprintf(stderr, "Couldn't find a compatible frame "
                    "buffer configuration on layer %d\n", layer_idx);
            return -1;
        }

        /*
         * We want the color buffer format to match the layer format,
         * so request the layer format through EGL_NATIVE_VISUAL_ID.
         */
        attribute_list[1]=linfo.format;

        /* Look for a compatible EGL frame buffer configuration */
        if (eglChooseConfig(display, attribute_list, &config, 1, &num_config)==EGL_TRUE)
        {
            if (num_config>0)
            {
                break;
            }
        }
    }

    /* create a 3D rendering target */
    if (gf_3d_target_create(&target, layer, NULL, 0, width, height, linfo.format)!=GF_ERR_OK)
    {
        fprintf(stderr, "Unable to create rendering target\n");
        return -1;
    }

    gf_layer_set_src_viewport(layer, 0, 0, width-1, height-1);
    gf_layer_set_dst_viewport(layer, 0, 0, width-1, height-1);
    gf_layer_enable(layer);

    /*
     * The layer settings haven't taken effect yet since we haven't
     * called gf_layer_update() yet.  This is exactly what we want,
     * since we haven't supplied a valid surface to display yet.
     * Later, the OpenGL ES library calls will call gf_layer_update()
     * internally, when  displaying the rendered 3D content.
     */

    /* create an EGL rendering context */
    econtext=eglCreateContext(display, config, EGL_NO_CONTEXT, NULL);
    if (econtext==EGL_NO_CONTEXT)
    {
        fprintf(stderr, "Create context failed: 0x%x\n", eglGetError());
        return -1;
    }

    /* create an EGL window surface */
    surface=eglCreateWindowSurface(display, config, target, NULL);
    if (surface==EGL_NO_SURFACE)
    {
        fprintf(stderr, "Create surface failed: 0x%x\n", eglGetError());
        return -1;
    }

    /* connect the context to the surface */
    if (eglMakeCurrent(display, surface, surface, econtext)==EGL_FALSE)
    {
        fprintf(stderr, "Make current failed: 0x%x\n", eglGetError());
        return -1;
    }

    init_scene(width, height);

    do {
        render_scene();
        glFinish();
        eglWaitGL();
        eglSwapBuffers(display, surface);
    } while(1);

    return 0;
}
예제 #25
0
/*****************************************************************************
Função que configura as cenas contidas no cartão sd
*****************************************************************************/
void cmd_scene(char *par) 
{
	char i,addr,erro = __FALSE, str[30];
	
	if(par[0] == '?')	/*Solicitando a alguma cena?*/	
	{
		if(par[1] >= '0' && par[1] <= '3')	/*Cenas de 0 a 3?*/
		{
			if(read_scene(par[1]-48,FILE_DIMMER_SCENE))
				sprintf(buf_tx,"%s%u",aux_scene,par[1]-48);
			else
				sprintf(buf_tx,"ERROR %u",ERROR_SD); 
		}else
		{
			sprintf(buf_tx,"%s%u", (current_scene[0]==0) ? "SET 0000000000007" : current_scene, current_id_scene);
			if(strcmp(current_scene,scene[current_id_scene])/*strlen(current_scene) < 15*/)
				sprintf(current_scene,"%s%u",scene[current_id_scene], current_id_scene);
		}	
		return;
	}

	memset(str,0,sizeof(str));

	strncpy(str,par,17);	/*Cena ex: 0SET 020020020000*/

	addr = str[0]-48;
	for(i=0;i<20;i++)		/*Loop para eliminar o id da cena da string...Ex: SET 020020020000*/
		str[i] = str[i+1];

	for(i=4;i<16;i++)		/*Loop para verificar possiveis erros de parâmetro*/
	{
		if(str[i] < '0' || str[i] > '9' || addr > 7)	
			erro = __TRUE;	

		if(str[i] == '\r' || str[i] == '\n')	/*Elimina caracteres indesejados da cena*/
			str[i] = 0;
	}

	//printf("str:%s\r",str);
	//fflush(stdout);

	if(strlen(str) != 16 || !strstr(str,"SET") || erro)	/*Há erro?*/
		sprintf(buf_tx,"ERROR %u",ERROR_PARAMETER);
	else
	{
		if(save_scene(str,addr))		/*A cena foi salva no cartão sd?*/
		{
			init_scene(addr);			/*Lê a cena para se certificar que foi escrita no sd*/

			sprintf(buf_tx,"%s%u",scene[addr],addr);
			if(rcv_cmd == RCV_CMD_UART_0)
			{	
				/*Envia imediatamente para o LPC1113 a alteração da cena 'addr' */
				uart_putString(UART_LINK_LPC,scene[addr]);
				uart_putString(UART_LINK_LPC,"!\0");
				strcpy(current_scene,scene[addr]);		/*Copia para a cena atual*/	
				current_id_scene = addr;
			}else
			{
				printf("Cena %u configurada: %s\r",addr,str);
				fflush(stdout);
			}
		}else
			sprintf(buf_tx,"ERROR %u",ERROR_SD);	/*Error permitido para cartão SD*/		
	}
}
예제 #26
0
/*****************************************************************************
** Function name:		U16 tcp_task (void)
**
** Descriptions:		envia dados para o servidor TCP
*****************************************************************************/
void tcp_task(void)
{
	static U32 tcp_timer 	= 0u;
	U8 buf_udp[100],i;
			
	/****************** instantâneo ********************************/

#if USE_TCP_SERVER 	/*Comunicação TCP SERVER será usada?*/

	U8 ip[4];

	#if USE_PCK_SERV 
	static U32 cnt_tcp_serv = 0u;

	if(tcp_state.bit.dataToSend)
 	{						
		tcp_state.bit.dataToSend = __FALSE;
		cnt_tcp_serv = 0;

		//if(tcp_buf[0] == 0)		
	 		//sprintf((char*)tcp_buf,"%02X.%02X.%02X.%02X.%02X.%02X\r\n\0",own_hw_adr[0],own_hw_adr[1],own_hw_adr[2],own_hw_adr[3],own_hw_adr[4],own_hw_adr[5]);
		
		//tcpSend((char*)tcp_buf, strlen((const char*)tcp_buf), tcp_server_soc, CMD_SEND_TO_SERVER);
		//memset(tcp_buf,0,sizeof(tcp_buf));
	}
	#endif

#endif

	/****************** a cada 100ms *******************************/

	if(!tick)
		return;
	++tcp_timer;
	dhcp_check();

	/****************** a cada 1s **********************************/

	if((tcp_timer%TASK_1S))
		return;

#if USE_TCP_CLIENT
	
	if(!(tcp_timer%TASK_5S)) 
	{
		/*Pacote UDP de identificação*/
		sprintf((char*)buf_udp,"%s %u.%u.%u.%u %02X.%02X.%02X.%02X.%02X.%02X %s %s %u.%u.%u.%u %u.%u.%u.%u\r\n\0",lhost_name,MY_IP[0],MY_IP[1],MY_IP[2],MY_IP[3],
		own_hw_adr[0],own_hw_adr[1],own_hw_adr[2],own_hw_adr[3],own_hw_adr[4],own_hw_adr[5], cfg.tcp.port_serv_rem, cfg.tcp.ip_serv_rem,
		MY_MASK[0], MY_MASK[1], MY_MASK[2], MY_MASK[3],  MY_GATEWAY[0], MY_GATEWAY[1], MY_GATEWAY[2], MY_GATEWAY[3]);	
										   

		if(!ftp_state.bit.UpdateTcp)
			udpSendBroadcast(buf_udp);
			//udpSendUnicast(buf_udp,cfg.tcp.ip_app);
	}

	if(!(tcp_timer%TASK_30S))	/*A cada 30s*/
	{ 
		/*Mantém o link ativo*/
		//if(tcp_get_state (tcp_client_soc[0]) == TCP_STATE_CONNECT)
		//{
			sprintf(buf_tx,"LOK OK\r\n\0");
			for(i=0;i<MAX_NUM_SOC;i++)
				tcpSend (buf_tx, strlen(buf_tx), tcp_client_soc[i], CMD_SEND_TO_CLIENT);
			//tcpSend (buf_tx, strlen(buf_tx), tcp_client_soc[0], CMD_SEND_TO_CLIENT);
		//}
	}

#endif


#if USE_TCP_SERVER && USE_PCK_SERV 	/*Comunicação TCP SERVER será usada?*/
		
	if(!(++cnt_tcp_serv % atoi(cfg.tcp.interval_packet_serv)))
		tcp_state.bit.dataToSend = __TRUE;

#endif

#if USE_TCP_SERVER	/*Comunicação TCP SERVER será usada?*/

	/*Analisa estado de comunicação com o servidor externo*/
	if(tcp_get_state (tcp_server_soc) != TCP_STATE_CONNECT)
	{
		tcp_state.bit.serverConnected = __FALSE; 
		inet_aton((U8*)cfg.tcp.ip_serv_rem,ip);
		tcp_connect(tcp_server_soc,ip,atoi(cfg.tcp.port_serv_rem),atoi(cfg.tcp.port_serv_loc));
		
	}else
		tcp_state.bit.serverConnected = __TRUE; 
	
#endif	

	/*Houve alteração das cenas via FTP?*/
	if(ftp_state.bit.UpdateScene)	
	{
		printf ("[Scene config via FTP]\r\r");
		fflush(stdout);
		ftp_state.bit.UpdateScene = __FALSE;
		init_scene(0xFF);
	}

	if(ftp_state.bit.UpdateFileCfg)
	{
		printf ("[CFG.CFG configurado via FTP]\r\r");
		fflush(stdout);
		ftp_state.bit.UpdateFileCfg = __FALSE;
		read_file_cfg();
	}
	
	/*Houve alteração das configurações TCP via FTP?*/
	if(ftp_state.bit.UpdateTcp)
	{
		printf ("[TCP Config via FTP..Reiniciando]\r\r");
		fflush(stdout);
				
#if USE_TCP_CLIENT	
		for(i=0;i<MAX_NUM_SOC;i++)
			tcp_close (tcp_client_soc[i]);
#endif
#if USE_TCP_SERVER	
		tcp_close (tcp_server_soc);
#endif
		LPC_WDT->WDTC = 0x003FFFF;	/*0.5s*/
		wdt_feed();
		while(1);
	}			
}
int main(int argc, char **argv)
{
	// initialisation  des paramètres de GLUT en fonction
	// des arguments sur la ligne de commande



	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

	maille = Maillage::lectureOff("C:/Users/etu/Downloads/bunny.off", 10);
	maille.calculNormalTriangle();
	//bunny.Ecriture("bunny.obj");

	rayon = 0;
	rayonX = (maille.xMax - maille.xMin) / maille.getScale();
	rayonY = (maille.yMax - maille.yMin) / maille.getScale();
	rayonZ = (maille.zMax - maille.zMin) / maille.getScale();


	if (rayonX > rayonY)
	{
		if (rayonX > rayonZ)
			rayon = rayonX;
		else
			rayon = rayonZ;
	}
	else
	{
		if (rayonY> rayonZ)
			rayon = rayonY;
		else
			rayon = rayonZ;
	}


	std::vector<Vector3D> geometrie = maille.getGeom();
	Vector3D centre = maille.getCentreGravite();
	double scale = maille.getScale();

	for (int i = 0; i < geometrie.size(); i++)
	{
		geometrie[i] = (geometrie[i] - centre) / scale;
	}

	maille.setGeom(geometrie);


	subdivision(maille.getCentreGravite(), rayon, 1);
	simplification();


	// définition et création de la fenêtre graphique
	glutInitWindowSize(WIDTH, HEIGHT);
	glutInitWindowPosition(0, 0);
	glutCreateWindow("Primitives graphiques");

	// initialisation de OpenGL et de la scène
	initGL();
	init_scene();

	// choix des procédures de callback pour 
	// le tracé graphique
	glutDisplayFunc(&window_display);
	// le redimensionnement de la fenêtre
	glutReshapeFunc(&window_reshape);
	// la gestion des événements clavier
	glutKeyboardFunc(&window_key);
	glutIdleFunc(&window_idle);
	// la boucle prinicipale de gestion des événements utilisateur
	glutMainLoop();

	return 1;
}
예제 #28
0
JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_init(JNIEnv * env, jobject obj,  jint width, jint height)
{
    init_scene(width, height);
    create_texture();
}