Proper way to Clear entire scene

Recommended Posts

I am clearing my scene entirely, where I use completely new sounds and new plans/textures.  What is the proper way to do this?

I'm first going through each of my planes and removing the plane and animations for each of them:


and do the same for the sounds.  Then I go to the scene and do the following:


The problem is I still see a lot of memory being used up, even after I do this and have an empty canvas on the screen.  Am I missing a step or going about this wrong?




Share this post

Link to post
Share on other sites
12 hours ago, Deltakosh said:

If you want a COMPLETE wipe of the memory you'll need to dispose the engine as well because it retains all shaders and all textures (in order to load them quickly afterwards)

From texture perspective at least, might there be a way to clear these copies once scene is loaded, or turn caching off to begin with?  Working with compressed textures for mobile devices (which share memory between CPU & Graphics cores), having to double RAM requirements (be it smaller than for  image textures) could limit the number of devices that a texture intensive scene would successfully run on.

It sounds like a good optimization for desktops with an actual separate GPU with its own memory, but on a SoC seems like it could be a limiting factor.

Not sure on the shader side.  They do not look that big.  BTW, when do you need either texture or shader?  Can context / GPU / graphics core run out of memory, and request the client reload it?

Share this post

Link to post
Share on other sites

Ran though this.  What is getting cached are WebGLTextures.  Think these are context objects, so not a duplication.  Either gl.compressedTexImage2D() or gl.texImage2D(), which actually load the data, do not reference the WebGLTexture, so looks like no double copy ends up in javascript.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.