Jump to content
  • Advertisement
Sign in to follow this  
muimui1911

Deleting Selected Object

This topic is 4555 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!