Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider to change preserveDrawingBuffer to false for webgl context #15

Closed
georgwaechter opened this issue Aug 19, 2016 · 2 comments
Closed

Comments

@georgwaechter
Copy link

georgwaechter commented Aug 19, 2016

I plan to use the library not only for desktop, but also for mobile phones, thus performance is important to me.

I've read that especially low performance devices would benefit from a "perserveDrawingBuffer": false situation, where the graphics driver can swap instead of copy the frame buffer. At the moment, the VideoContext constructor always uses "preserveDrawingBuffer: true.

I want to open this issue to make sure we can check (later on) whether this is possible for the implementation and how big the performance speedup is on low end devices.

Some links for reference:
http://stackoverflow.com/questions/27746091/preservedrawingbuffer-false-is-it-worth-the-effort
https://www.khronos.org/webgl/public-mailing-list/archives/1110/msg00003.php

Georg

MatthewShotton pushed a commit that referenced this issue Aug 22, 2016
… manualUpdate #14 and setting preseveDrawingBuffer #15
@MatthewShotton
Copy link
Contributor

MatthewShotton commented Aug 22, 2016

Hi Georg,

As part of a change to support passing in options to the VideoContext's constructor I've added a way to pass in custom context attributes to the underlying WebGL context. It can be used like the following:

var videoContextOptions = {webglContextAttributes: {preserveDrawingBuffer: true, alpha: false}};
var videoContext = new VideoContext(canvas, undefined, videoContextOptions);

The default context attributes for the webGL context are:

 {preserveDrawingBuffer: true, alpha: false}

Changing things away from the default should be considered undefined behaviour for now. But it should give you the functionality required to experiment to find optimal parameters for mobile.

Feel free to re-open this issue if this doesn't provide the required functionality.

EDIT: This is now available on NPM as version 0.19.0.

Kind regards,
Matt

@MatthewShotton
Copy link
Contributor

Hmm, on second thoughts I'll reopen this issue as a reminder that we might want to change the default setting for preserveDrawingBuffer once performance/functionality test have taken place.

Kind regards,
Matt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants