示例#1
0
void video_display_destroy() {
	//no need to clean stuff if it hasn't been initialized.
	if (!initialized)
		return;

	int i = 0;
	initialized = 0;

	SDL_DestroyTexture(frameTex);
	for (i = 0 ; i < VIDEO_NB_NAV_INFOS ; i++)
		if (graphs[i].tex != NULL)
			SDL_DestroyTexture(graphs[i].tex);

	//Free graphical elements list
	pthread_mutex_lock(&mutex_graphics_list);
	struct graphics_list *current = icon_registry;
	while (current != NULL) {
		struct graphics_list *del = current;
		current = current->next;
		video_graphic_destroy(del);
	}
	icon_registry = NULL;
	pthread_mutex_unlock(&mutex_graphics_list);

	SDL_DestroyRenderer(renderer);
	SDL_DestroyWindow(win);
	video_clean_text();
	IMG_Quit();
	SDL_Quit();
	jakopter_com_remove_channel(CHANNEL_CALLBACK);
	jakopter_com_remove_channel(CHANNEL_DISPLAY);
}
示例#2
0
文件: visp.cpp 项目: Drone2/utils
void visp_destroy()
{
	if (initialized) {
#if defined(VISP_HAVE_X11)
		if (display_X)
			delete display_X;
#elif defined(VISP_HAVE_OPENCV)
		if (display_cv)
			delete display_cv;
#endif
		if (display_img)
			delete display_img;
		if (grey_img)
			delete grey_img;
		initialized = false;
	}
	jakopter_com_remove_channel(CHANNEL_DISPLAY);
	jakopter_com_remove_channel(CHANNEL_CALLBACK);
}
示例#3
0
/**
* Clean the display context : close the window and clean SDL structures.
*/
void video_display_clean() {
	int i=0;
	//no need to clean stuff if it hasn't been initialized.
	if(initialized) {
		SDL_DestroyTexture(frameTex);
		for(i=0 ; i<VIDEO_NB_NAV_INFOS ; i++)
			if(graphs[i].tex != NULL)
				SDL_DestroyTexture(graphs[i].tex);
		SDL_DestroyRenderer(renderer);
		SDL_DestroyWindow(win);
		video_clean_text();
		SDL_Quit();
		jakopter_com_remove_channel(CHANNEL_DISPLAY);
		initialized = 0;
	}
}
示例#4
0
/**
  * \brief Stop navdata thread.
  * \return the pthread_join value or -1 if communication already stopped.
  */
int navdata_disconnect()
{
	int ret;
	pthread_mutex_lock(&mutex_stopped);

	if (!stopped_navdata) {
		stopped_navdata = true;
		pthread_mutex_unlock(&mutex_stopped);
		ret = pthread_join(navdata_thread, NULL);

		jakopter_com_remove_channel(CHANNEL_NAVDATA);

		close(sock_navdata);
	}
	else {
		pthread_mutex_unlock(&mutex_stopped);

		fprintf(stderr, "[~][navdata] Communication already stopped\n");
		ret = -1;
	}

	return ret;
}