I have a problem to set colors in WebGL. I can draw with primary colors but not with other RGBA colors.
iRenderer.SetColorRgba(127,254,212, 1);
iRenderer.SetColorFillMode();
iRenderer.ConvexPoly([myx, myy, myx+w, myy, myx+w, myy+h, myx, myy+h]);
[/code:jfq526sl]
[b]runtime.js[/b]
[code:jfq526sl]
instanceProto.drawGL = function(glw) {
var myx = this.x;
var myy = this.y;
var w = this.width;
var h = this.height;
glw.setColorFillMode(255, 255, 0, 1);
glw.quad(myx, myy, myx+w, myy, myx+w, myy+h, myx, myy+h);
};
[/code:jfq526sl]
But if I change
[b]instance.js[/b] iRenderer.SetColorRgba(127, 254, 212, 1);
[b]runtime.js[/b] glw.setColorFillMode(127, 254, 212, 1);
I have a white quad.
Instead in [b]instanceProto.draw[/b] I can draw a coloured quad simply changing [i]ctx.fillStyle[/i]
[code:jfq526sl]
// ctx.fillStyle = `rgba(255, 255, 0, 1)`;
ctx.fillStyle = `rgba(127, 254, 212, 1)`;
ctx.beginPath();
ctx.moveTo(myx, myy);
ctx.lineTo(myx+w, myy);
ctx.lineTo(myx+w, myy+h);
ctx.lineTo(myx, myy+h);
ctx.closePath();
ctx.fill();
[/code:jfq526sl]
What's wrong with what I'm doing?