pissang / claygl

A WebGL graphic library for building scalable Web3D applications
http://claygl.xyz/
BSD 2-Clause "Simplified" License
2.8k stars 302 forks source link

No way to pass options to Renderer when creating app ? #101

Closed scarletsky closed 5 years ago

scarletsky commented 5 years ago

I want to take the screenshot and I need to pass preserveDrawingBuffer = true to the renderer.

But in the source code of App3D:

var rendererOpts = {};
isDomCanvas && (rendererOpts.canvas = dom);
appNS.devicePixelRatio && (rendererOpts.devicePixelRatio = appNS.devicePixelRatio);

var gRenderer = new Renderer(rendererOpts);

So, how can I do this ? Create another class App3D by myself ?

pissang commented 5 years ago

Thank you for pointing out this inconvenient. Never noticed that.

I've made a commit to fix it. You can now use glAttributes property to configure preserveDrawingBuffer when creating application.

application.create({
  glAttributes: { preserveDrawingBuffer: true }
});
scarletsky commented 5 years ago

That's great !