Oh :o
Nice, thanks. I'll look into this. I'll need to learn some proper webgl first. I didn't know you could get C2's gl by doing glw.gl xD.
I guess I misread glwrap.js cause I never saw anywhere anything named this.gl, only gl.
Oh interesting, I didn't know "multiply" was one of the options now. It didn't used to be. I'm not sure if that would cause compatibility issues on some browsers.
Well it seems like most browsers support it. Every browser except Edge 11 and prior. Edge 12 supports it.
According to MDN: developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
I hadn't thought of creating individual letters of different colors as needed and keeping them for later use. Probably works well when only using a limited amount of colors. If the user ended up trying to do gradual color transitions you may run out of video memory though.
Yeah it works pretty well in most cases. But indeed it may become inefficient if a user uses too many colors for too many characters. However run out of video memory? How so? Maybe run out of RAM, but VRAM? I'm genuinely asking here. I create the texture on a virtual canvas, and then store it in a JS object. I never actually add the canvas to the document. Would that still use up some video memory?
It's not bad to end a batch in c2's renderer. It does it all the time. All a batch does is it sends multiple quads using the same texture at the same time instead of separately. Besides you'd be doing your own batching of all the letters in your spritefont renderer. The only drawback is if multiple spritefont instances drawn right after each other then they could only be batched individually instead of together, but I say it doesn't matter too much.
Yeah ok I kinda get it. I really need to learn webgl, because I didn't know most of that.
Maybe that could be a useful example to use alongside a webgl tutorial.
Yes thanks again. I'll look into it and maybe I can use that to make the code more optimized.