remvst Posted April 16, 2015 Share Posted April 16, 2015 I am currently trying to adapt the resolution of my game based on the framerate I'm getting on the first ~30 seconds. Basically, measure the framerate for the first seconds, and if it's too low, work with a smaller resolution. Right now, this is the code I have: setResolution : function(resolution){ this.renderer.destroy(); var rendererOptions = { resolution : resolution }; this.renderer = new PIXI.WebGLRenderer(this.params.width,this.params.height,rendererOptions); var parent = this.canvas.parentNode; parent.insertBefore(this.renderer.view, this.canvas); parent.removeChild(this.canvas); this.canvas = this.renderer.view; this.canvas.id = this.params.canvasId; }It works fine with a CanvasRenderer, but not with a WebGLRenderer, because of cached data. I'm getting this error:Uncaught TypeError: Cannot read property 'data' of undefinedNow, I was wondering if there was a way to reset all this cached data so I can still use a WebGLRenderer. Can anyone help? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.