Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

no one

scene graph, memory management...

This topic is 5440 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 I have written a few classes such as a smart pointer class, a linked list class and I recently added a link list system to my entity class. The smart pointer I guess is only used so that when you create a *new* instance of a class and store the object into the entity list, the pointer can be deleted without memory leaks. Anyway, the entity list I figured I could ecapsolate into a scene class which would do garbage collection and would process the entities function recrusively depending on if the entity has children. The garbage collection function though, right now it only loops through the entity list and looks for PARENT entities that are in active and then removes them and calls there free function, say the entity had children though, should you simple make the entities first child its own parent? ex: a charactor with a sword... the charactor dies, but the sword will stay for another charactor to pick up... I figured that only parent objects will be stored in the entity list since children entities will be connected to them thus making them not direct parents. Anway, that method has no refrence checking to see rather the entity is still in use thus making it error prone. How do you add that? Also, my texture class only deals with a single image pointer per each instance of the class. In the loading function, it loops through a loaded list to see if the texture has already been loaded and if so, it simply sets the new image pointer to that of the previously loaded. I think this is fine, but when it comes to freeing the image pointer from the list... I delete the OpenGL texture id, but Im not sure how to properly remove the pointer from the list. *note that I did make a function which frees the texture list at program exit time* Can anyone help me out here, this is very confusing to me... Thanks a ton in advance and Sorry about the thread length.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!