Пример #1
0
void free_resources() {	
	if(resources.state & RS_SfxLoaded) {
		printf("-- freeing sounds\n");
		delete_sounds();
		printf("-- alutExit()\n");
		alutExit();
	}
	
	printf("-- freeing textures\n");
	delete_textures();
	
	printf("-- freeing models\n");
	delete_animations();
	
	printf("-- freeing VBOs\n");
	delete_vbo(&_vbo);
	
	if(resources.state & RS_ShaderLoaded) {
		printf("-- freeing FBOs\n");
		delete_fbo(&resources.fbg[0]);
		delete_fbo(&resources.fbg[1]);
		delete_fbo(&resources.fsec);
		
		printf("-- freeing shaders\n");
		delete_shaders();
	}
}
Пример #2
0
int bind_noaudio_set(void *b, int v)
{
	int i = bind_common_onoffset_inverted(b, v);
	
	if(v)
	{
		alutExit();
		printf("-- Unloaded ALUT\n");
		
		if(resources.state & RS_SfxLoaded)
		{
			delete_sounds();
			resources.state &= ~RS_SfxLoaded;
		}
	}
	else
	{
		if(!alutInit(NULL, NULL))
		{
			warnx("Error initializing audio: %s", alutGetErrorString(alutGetError()));
			tconfig.intval[NO_AUDIO] = 1;
			return 1;	// index of "off"
		}
		tconfig.intval[NO_AUDIO] = 0;
		printf("-- ALUT\n");
		
		load_resources();
	}
	
	return i;
}