Esempio n. 1
0
void VertexBuffer::SetStaticVertexData(SceneNode * nodes[], unsigned int count)
{
	use_vao = GLC_ARB_vertex_array_object && good_vao;

	age_static += 2;

	Clear();

	// make sure dynamic buffer objects are allocated
	InitDynamicBufferObjects();

	BindStaticVertexData bind_data(*this);
	for (unsigned int i = 0; i < count; ++i)
	{
		assert(nodes[i]);
		nodes[i]->ApplyDrawableFunctor(Wrapper<BindStaticVertexData>(bind_data));
	}

	std::vector<unsigned int> index_buffer;
	std::vector<float> vertex_buffer;
	for (unsigned int i = 0; i <= VertexFormat::LastFormat; ++i)
	{
		UploadStaticVertexData(objects[i], bind_data.varrays[i], index_buffer, vertex_buffer);
	}
}
Esempio n. 2
0
void VertexBuffer::SetDynamicVertexData(SceneNode * nodes[], unsigned int count)
{
	use_vao = GLC_ARB_vertex_array_object && good_vao;

	age_dynamic += 2;

	InitDynamicBufferObjects();

	BindDynamicVertexData bind_data(*this);
	for (unsigned int i = 0; i < count; ++i)
	{
		assert(nodes[i]);
		nodes[i]->ApplyDrawableFunctor(Wrapper<BindDynamicVertexData>(bind_data));
	}

	for (unsigned int i = 0; i <= VertexFormat::LastFormat; ++i)
	{
		UploadDynamicVertexData(objects[i], staging_index_buffer[i], staging_vertex_buffer[i]);
	}
}
Esempio n. 3
0
/*!
  \brief load_gui_tabs_pf() is called after interrogation completes 
  successfully. It's purpose is to load all the glade files and datamaps 
  as specified in the interrogation profile of the detected firmware. 
  \param notebook is the pointer to the notebook the new tab should be placed
  \param page is the page number to load
  \returns TRUE on success, FALSE on failure
  */
G_MODULE_EXPORT gboolean load_actual_tab(GtkNotebook *notebook, gint page)
{
	ConfigFile *cfgfile = NULL;
	gchar * map_file = NULL;
	gchar * glade_file = NULL;
	gchar * tmpbuf = NULL;
	GladeXML *xml = NULL;
	GtkWidget *label = NULL;
	GtkWidget *topframe = NULL;
	GtkWidget *placeholder = NULL;
	GHashTable *groups = NULL;
	GList *tab_widgets = NULL;
	BindGroup *bindgroup = NULL;
	extern GdkColor red;

	ENTER();
	placeholder =  gtk_notebook_get_nth_page(notebook,page);
	label = gtk_notebook_get_tab_label(notebook,placeholder);

	glade_file = (gchar *)OBJ_GET(label,"glade_file");
	map_file = (gchar *)OBJ_GET(label,"datamap_file");
	xml = glade_xml_new(glade_file,"topframe",NULL);
	g_return_val_if_fail(xml,FALSE);
	thread_update_logbar("interr_view",NULL,g_strdup(_("Load of tab: ")),FALSE,FALSE);
	thread_update_logbar("interr_view","info", g_strdup_printf("\"%s\"",glade_file),FALSE,FALSE);
	thread_update_logbar("interr_view",NULL,g_strdup(_(" completed.\n")),FALSE,FALSE);
	thread_update_logbar("interr_view",NULL,g_strdup(_("Load of tabconf: ")),FALSE,FALSE);
	thread_update_logbar("interr_view","info", g_strdup_printf("\"%s\"",map_file),FALSE,FALSE);
	cfgfile = cfg_open_file(map_file);
	if (cfgfile)
	{
		topframe = glade_xml_get_widget(xml,"topframe");
		if (topframe == NULL)
		{
			MTXDBG(TABLOADER|CRITICAL,_("\"topframe\" not found in xml, ABORTING!!\n"));
			set_title(g_strdup(_("ERROR Gui Tab XML problem, \"topframe\" element not found!!!")));
			EXIT();
			return FALSE;
		}
		OBJ_SET_FULL(topframe,"glade_xml",(gpointer)xml,g_object_unref);
		// bind_data() is recursive and will take 
		// care of all children

		bindgroup = g_new0(BindGroup,1);
		groups = load_groups(cfgfile);
		bindgroup->cfgfile = cfgfile;
		bindgroup->groups = groups;
		bindgroup->map_file = g_strdup(map_file);
/*		tab_widgets = g_list_prepend(tab_widgets,topframe);
		OBJ_SET(topframe,"tab_widgets",tab_widgets);
		*/
		bindgroup->topframe = topframe;
		bind_data(topframe,(gpointer)bindgroup);
		g_free(bindgroup->map_file);
		if (groups)
			g_hash_table_destroy(groups);
		groups = NULL;
		/* Clear not_rendered flag */
		OBJ_SET(label,"not_rendered",NULL);

		populate_master(topframe,(gpointer)cfgfile);

		gtk_box_pack_start(GTK_BOX(placeholder),topframe,TRUE,TRUE,0);
		OBJ_SET(placeholder,"topframe",topframe);
		glade_xml_signal_autoconnect(xml);
		g_free(bindgroup);
		if (cfg_read_string(cfgfile,"global","post_functions",&tmpbuf))
		{
			run_post_functions(tmpbuf);
			g_free(tmpbuf);
		}
		cfg_free(cfgfile);
		gtk_widget_show(topframe);
		/*printf("Current length of tab_widgets is %i\n",g_list_length(OBJ_GET(topframe,"tab_widgets")));*/
		thread_update_logbar("interr_view",NULL,g_strdup(_(" completed.\n")),FALSE,FALSE);
	}
	update_groups_pf();
	update_sources_pf();
	/* Allow gui to update as it should.... */
	gdk_flush();
	EXIT();
	return TRUE;
}