Deleting Selected Object

Started by
0 comments, last by Supernat02 18 years, 3 months ago
hello everyone: I would like to load the object in and delete it freely. e.g. Load the object by File->Load (which i have already done) and then the other things is to delete the selected object. could anyone help me or give me some hints on how to delete the object in memory. all the loaded objects are stored in "vector<C3dsLoader> vObjects".

C3dsLoader obj3dsLoader;
vector<C3dsLoader> vObjects;


//when loading object, this will load the objects geometry into vObjects.
ZeroMemory(szPath, 200);
GetWindowsDirectory(szPath, 200);

if(!GetFilename(szPath))
return 0 ;
else
{
vObjects.push_back( obj3dsLoader );
vObjects[vObjects.size()-1].Init_3ds(szPath);
Load = TRUE;
}
break;

//When I draw the objects out in render scene

	if(load)
	{ 
		for ( int i =0 ; i< vObjects.size(); i++ )
		{
			if (mode == GL_SELECT) 
			{
				glPushName(i);
				vObjects.Render_3ds();
				glPopName();
	
			}
			else
				if(mode == GL_RENDER)
				vObjects.Render_3ds();
		}
	}


Millions of thanks
Advertisement
You can't release the memory for the original C3dsLoader object obj3dsLoader. Since the vector creates a copy of that object, you would just use the vector to erase that copy. I believe it's vObjects.erase(index) or vObjects.delete(index). The proper function call escapes me at the moment.

Good luck,
Chris
Chris ByersMicrosoft DirectX MVP - 2005

This topic is closed to new replies.

Advertisement