Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/webgl/shaders/phong.frag
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void main(void) {
inputs.texCoord = vTexCoord;
inputs.ambientLight = vAmbientColor;
inputs.color = isTexture
? TEXTURE(uSampler, vTexCoord) * uTint/255.
? TEXTURE(uSampler, vTexCoord) * (vec4(uTint.rgb/255., 1.) * uTint.a/255.)
: vColor;
if (isTexture && inputs.color.a > 0.0) {
// Textures come in with premultiplied alpha. Temporarily unpremultiply it
Expand Down
10 changes: 5 additions & 5 deletions test/unit/visual/cases/webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ visualSuite('WebGL', function() {
visualTest('Basic colors have opacity applied correctly', (p5, screenshot) => {
p5.createCanvas(50, 50, p5.WEBGL);
p5.background(255);
p5.fill(255, 0, 0, 100);
p5.fill(255, 100, 100, 100);
p5.circle(0, 0, 50);
screenshot();
});
Expand All @@ -384,7 +384,7 @@ visualSuite('WebGL', function() {
p5.createCanvas(50, 50, p5.WEBGL);
p5.background(255);
p5.ambientLight(255);
p5.fill(255, 0, 0, 100);
p5.fill(255, 100, 100, 100);
p5.circle(0, 0, 50);
screenshot();
});
Expand All @@ -393,7 +393,7 @@ visualSuite('WebGL', function() {
p5.createCanvas(50, 50, p5.WEBGL);
const myShader = p5.baseMaterialShader().modify({
'Inputs getPixelInputs': `(Inputs inputs) {
inputs.color = vec4(1., 0., 0., 100./255.);
inputs.color = vec4(1., 0.4, 0.4, 100./255.);
return inputs;
}`
})
Expand All @@ -406,7 +406,7 @@ visualSuite('WebGL', function() {
visualTest('Colors in textures have opacity applied correctly', (p5, screenshot) => {
p5.createCanvas(50, 50, p5.WEBGL);
const tex = p5.createFramebuffer();
tex.draw(() => p5.background(255, 0, 0, 100));
tex.draw(() => p5.background(255, 100, 100, 100));
p5.background(255);
p5.texture(tex);
p5.circle(0, 0, 50);
Expand All @@ -416,7 +416,7 @@ visualSuite('WebGL', function() {
visualTest('Colors in tinted textures have opacity applied correctly', (p5, screenshot) => {
p5.createCanvas(50, 50, p5.WEBGL);
const tex = p5.createFramebuffer();
tex.draw(() => p5.background(255, 0, 0, 255));
tex.draw(() => p5.background(255, 100, 100, 255));
p5.background(255);
p5.texture(tex);
p5.tint(255, 100);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.