PDA

View Full Version : How to release WebGL Resources ?



esmarques
07-03-2012, 10:16 PM
Please consider an application for walking thru two large buildings, linked by a door.
Whenever the camera crosses the inter-connection door, I want to release most (all?) WebGL resources (shaders, buffers, textures, etc) allocated for the previous building so that I can setup new WebGL resources for the new building.
Am I supposed to carefully keep track of all WebGL resources in order to release them explicitely?
Otherwise, is there an easier way to release all WebGL resources? (Other than reloading the whole HTML page.)

So far, my best guess is to call resetToInitialState(gl) from webgl-debug.js:

https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/debug/webgl-debug.js

Please advise!

Thanks,
Everton