Skip to content

Texture colors altered on some browsers #39

@MartinSStewart

Description

@MartinSStewart

I've noticed that on two occasions (once in someone's Firefox browser and I don't recall which browser the other person was using), textures would have some kind of color correction applied. This would cause problems for this app I'm working on https://town-collab.app where certain texture colors (such as FF00FF) get replaced with user chosen colors at runtime. The color correction causes the game to look like this
image

The fix was to add gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, false);. Ideally the webgl package should do this automatically though?

Perhaps also gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false); should be used. I haven't encountered any problems with premultiplication but I suspect some browsers are going to randomly have different default values here too.

Edit: For reference, I got the two lines of code from here https://stackoverflow.com/questions/31500597/fragment-shader-wrong-color-value-from-texture

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions