Exca Posted May 9, 2019 Share Posted May 9, 2019 Is it possible to change preserveDrawingBuffer after renderer initialization in v4? I have a case where player can save a screenshot from a button, and the data is rendered to 2d canvas with extra info and that is then offered to player. If I use preserveDrawingBuffer then it works fine. If I toggle it off, then a black screen is saved. Having the preserve on though has a bad impact on performance on certain devices, so it would be better to use it only when needed. Any way to achieve this? Quote Link to comment Share on other sites More sharing options...
Exca Posted May 9, 2019 Author Share Posted May 9, 2019 From webgl specification: The WebGLContextAttributes object is only used on the first call to getContext. No facility is provided to change the attributes of the drawing buffer after its creation. So can't do that. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 9, 2019 Share Posted May 9, 2019 Use extract (readPixels) just after the frame, not in interaction event. Its a known problem. Quote Link to comment Share on other sites More sharing options...
Exca Posted May 9, 2019 Author Share Posted May 9, 2019 4 minutes ago, ivan.popelyshev said: Use extract (readPixels) just after the frame, not in interaction event. Its a known problem. Would do that if I could. The image generation part is done elsewhere, same thing saves everything client sees on screen, including dom-elements. Or maybe I could create an offscreen canvas from extract -data and use that as a replacement when image is being generated. Need to look into it. 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.