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

WebGL support for bqplot (threejs based) #714

Merged
merged 5 commits into from
Nov 7, 2018

Conversation

maartenbreddels
Copy link
Member

This adds support for WebGL based on threejs (although I think we can also support regl). This will be the basis for #661 and #630.

It works by overlaying a canvas on top of the svg (for performance reasons). However, when a screenshot is needed, the canvas is converted to an image and embedded.

@maartenbreddels
Copy link
Member Author

@SylvainCorlay do you feel like merging this or should we first attempt to recover from lost webgl context, similar to what jupyter-threejs is doing (cc @vidartf), and make ipyvolume, jupyter-threejs and bqplot use a similar strategy for recovering.
We may also want to align this with the plotly folks (cc @jonmmease @jackparmer) so that we are not all fighting for a webgl context.

}

float scale_transform_log(float domain_value, vec2 range, vec2 domain) {
float normalized = (log(domain_value) - log(domain[0])) / (log(domain[1]) - log(domain[0]));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log(domain_value / domain[0]) / log(domain[1] / domain[0])); (for speed?)


float scale_transform_log_inverse(float range_value, vec2 range, vec2 domain) {
float normalized = (range_value - range[0]) / (range[1] - range[0]);
float domain_value = exp(normalized * (log(domain[1]) - log(domain[0])) + log(domain[0]));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem?

@@ -18,6 +18,9 @@ var d3 = require("d3");
var _ = require("underscore");
var popperreference = require("./PopperReference");
var popper = require("popper.js");
var THREE = require('three')

THREE.ShaderChunk['scales'] = require('raw-loader!../shaders/scales.glsl')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we namespace scales?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bqscales?

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

Successfully merging this pull request may close these issues.

None yet

2 participants