{"action":"created","issue":{"url":"https://api.github.com/repos/bokeh/bokeh/issues/2391","labels_url":"https://api.github.com/repos/bokeh/bokeh/issues/2391/labels{/name}","comments_url":"https://api.github.com/repos/bokeh/bokeh/issues/2391/comments","events_url":"https://api.github.com/repos/bokeh/bokeh/issues/2391/events","html_url":"https://github.com/bokeh/bokeh/pull/2391","id":87352600,"number":2391,"title":"Initial WebGL support (take 4)","user":{"login":"almarklein","id":3015475,"avatar_url":"https://avatars.githubusercontent.com/u/3015475?v=3","gravatar_id":"","url":"https://api.github.com/users/almarklein","html_url":"https://github.com/almarklein","followers_url":"https://api.github.com/users/almarklein/followers","following_url":"https://api.github.com/users/almarklein/following{/other_user}","gists_url":"https://api.github.com/users/almarklein/gists{/gist_id}","starred_url":"https://api.github.com/users/almarklein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/almarklein/subscriptions","organizations_url":"https://api.github.com/users/almarklein/orgs","repos_url":"https://api.github.com/users/almarklein/repos","events_url":"https://api.github.com/users/almarklein/events{/privacy}","received_events_url":"https://api.github.com/users/almarklein/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bokeh/bokeh/labels/status:%20WIP","name":"status: WIP","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-06-11T13:46:03Z","updated_at":"2015-07-14T12:49:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bokeh/bokeh/pulls/2391","html_url":"https://github.com/bokeh/bokeh/pull/2391","diff_url":"https://github.com/bokeh/bokeh/pull/2391.diff","patch_url":"https://github.com/bokeh/bokeh/pull/2391.patch"},"body":"issues: #2036\r\n\r\nThis puts most of the architecture in place to allow glyphs to render in WebGL.\r\n\r\n### Todo\r\n\r\n* [x] base architecture\r\n* [x] fix plot._paint_empty to draw borders and have clipping done correctly\r\n* [x] check that blending works ok in different situations (e.g. when rendering both gl and normal glyphs)\r\n* [x] do not render in gl when the coordinate system is not isometric\r\n* [x] allow turning webgl off/on using an environment variable. Default False. Settable in JS as `window.BOKEH_WEBGL`.\r\n* [x] circle glyph use correct size, color, etc.\r\n* [x] make work for selections \r\n* [x] make sure that things work ok on FF\r\n* [x] make sure that things work ok on Chrome\r\n* [ ] make sure that things work ok on IE\r\n* [ ] make sure that things work ok on Safari\r\n* [x] use indices\r\n* [x] radius-in-data-units for circle glyph\r\n* [x] see if boilerplate code can be put in one place (instead on each glyph)\r\n* [x] <s>combine multiple lines in one buffer (i.e. gl collections), could be a separate PR</s>\r\n* [x] <s>On Firefox, everything look blurry: interpolation when blitted into \r\nthe 2D canvas</s>\r\n* [x] implement `angles` for marker glyphs (need something different than circle in that case :))\r\n* [x] oh crap, we need something to turn colors into RGBA tuples ... I have a hex2rgb, but also `rgb(...)`, and 'red', 'violet', etc.\r\n* [x] documentation\r\n* [ ] weird all-sprites-become-1px-when-one-get-clipped behavior on IE\r\n* [x] look into `premultipliedAlpha` canvas/context attribute for blending\r\n\r\n### Overview of this PR\r\n\r\n* Basic architecture for rendering glyphs in GL is in place. Blending works appropriately. \r\n* The circle and square markers are implemented and look *very* close to the 2D drawn version (2d-drawn is slightly more crisp/jaggy, gl-drawn has more emphasis on aa, can be tweaked). Additional markers can be added relatively easy if they can be \"geometrically described in GLSL\".\r\n* Markers implement `x`, `y`, `size`/`sradius`, fill and line `color`, fill and line `alpha`, `angle`.\r\n* All (I think) CSS colors are translated to rgba tuples for webgl.\r\n* WebGL can be enabled by setting a global parameter `window.BOKEH_WEBGL`. Good for testing, but we need something simpler to enable webgl per-plot.\r\n* Add three examples, one to demonstrate blending, the others to demonstrate drawing many points.\r\n* Docs about this.\r\n\r\n### Notes\r\n\r\n* Glyphs drawn in webgl are drawn on top of other glyphs (because they're rendered to the gl canvas first, which get merged into the 2D canvas after all glyphs have drawn).\r\n* When the transformation is non-linear (e.g. log), the system falls back to 2D rendering.\r\n* Using indices does not work when there are more than 65k data points, due to a a webgl limitation (index buffers can only be UINT16).\r\n* Typical browsers restrict the number of GL contexts to 16. The oldest context are discarded when a new one is created. So in an example like `file/glyphs.py` half the plots will fail.\r\n\r\n### Up next\r\n\r\n* decide how users are going to turn webgl on. Maybe via a tool?\r\n* see if we can make plots share a gl context to allow 10+ plots on one page\r\n* more markers\r\n* line glyph\r\n* use memory buffers instead of arrays for our data\r\n* find bokehjs bottlenecks and improve them\r\n* other glyphs (e.g. maps)\r\n"},"comment":{"url":"https://api.github.com/repos/bokeh/bokeh/issues/comments/121229848","html_url":"https://github.com/bokeh/bokeh/pull/2391#issuecomment-121229848","issue_url":"https://api.github.com/repos/bokeh/bokeh/issues/2391","id":121229848,"user":{"login":"bryevdv","id":1078448,"avatar_url":"https://avatars.githubusercontent.com/u/1078448?v=3","gravatar_id":"","url":"https://api.github.com/users/bryevdv","html_url":"https://github.com/bryevdv","followers_url":"https://api.github.com/users/bryevdv/followers","following_url":"https://api.github.com/users/bryevdv/following{/other_user}","gists_url":"https://api.github.com/users/bryevdv/gists{/gist_id}","starred_url":"https://api.github.com/users/bryevdv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryevdv/subscriptions","organizations_url":"https://api.github.com/users/bryevdv/orgs","repos_url":"https://api.github.com/users/bryevdv/repos","events_url":"https://api.github.com/users/bryevdv/events{/privacy}","received_events_url":"https://api.github.com/users/bryevdv/received_events","type":"User","site_admin":false},"created_at":"2015-07-14T12:49:30Z","updated_at":"2015-07-14T12:49:30Z","body":"Putting a `webgl` flag on `Plot` seems like a reasonable alternative path. Is there a reason not to implement it now? It seems like one property added to `Plot` and then having wherever you currently switch webgl on/off check that property instead? Then we could definitely punt on the env var for defaults to a later PR. "}}