mattdesl / webgl-lines

some interactive content for a blog post
http://mattdesl.svbtle.com/drawing-lines-is-hard
MIT License
415 stars 37 forks source link

Canvas or WebGL #5

Open gaitat opened 7 years ago

gaitat commented 7 years ago

What do I need to do to get WebGL rendering? The way it is currently Canvas is used.

mattdesl commented 7 years ago

All the content should already be rendering in WebGL: https://mattdesl.svbtle.com/drawing-lines-is-hard

WebGL is implemented in the browser's <canvas> tag.

gaitat commented 7 years ago

I see in webgl-lines\base\index.js you have let isWebGL = opt.context === 'webgl' which comes back false and then when I explicitly change the context to have webgl

let context = require('../base')(render, { name: __dirname, description: "_touch and drag to draw_ rendering with triangles ", context: "webgl" })

I get

Uncaught TypeError: context.clearRect is not a function at render (bundle.js:37) at renderRetina (bundle.js:1247) at Array.resize (bundle.js:1204) at drainQueue (bundle.js:2263)

so webgl is not enabled.