Skip to content

Conversation

@takahirox
Copy link
Collaborator

@takahirox takahirox commented Mar 11, 2019

.flipY and .premultiplyAlpha of Texture properties with ImageBitmap are ignored because UNPACK_FLIP_Y_WEBGL, UNPACK_PREMULTIPLY_ALPHA_WEBGL (, and UNPACK_COLORSPACE_CONVERSION_WEBGL) for gl.pixelStorei are ignored if the image source is ImageBitmap.

https://www.khronos.org/registry/webgl/specs/latest/1.0/#6.10

I'd like to add the note about it to ImageBitmapLoader document. Please feel free to correct the sentences if looking weird because English isn't my first language.

</p>

<p>
Note that [page:Texture.flipY .flipY] and [page:Texture.premultiplyAlpha .premultiplyAlpha] properties of [page:Texture]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would shortly note why both properties are ignored (because unlike normal images they are needed when the bitmap is created; not at texture upload time).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, how about adding

... are ignored because corresponding UNPACK_FLIP_Y_WEBGL and UNPACK_PREMULTIPLY_ALPHA_WEBGL parameters for gl.pixelStorei() are ignored if image source is ImageBitmap.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems more important to me to differentiate between creation and upload time of the texture. In context of ImageBitmap, you need these configuration parameters when creating the bitmap. In all other cases, you need them when the texture is uploaded to the GPU. That's the important bit users should aware of and the reason why setting Texture.flipY and Texture.premultiplyAlpha after the creation process are ignored.

Copy link
Collaborator Author

@takahirox takahirox Mar 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this

Note that Texture.flipY and Texture.premultiplyAlpha with ImageBitmap are ignored. ImageBitmap needs these configuration on bitmap creation unlike regular images need them on uploading to GPU. You need to set the equivalent options via ImageBitmapLoader.setOptions() instead. Refer to WebGL specification for the detail.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good 👍!

@takahirox
Copy link
Collaborator Author

Updated.

@mrdoob mrdoob added this to the r103 milestone Mar 11, 2019
@mrdoob mrdoob merged commit 8829b97 into mrdoob:dev Mar 11, 2019
@mrdoob
Copy link
Owner

mrdoob commented Mar 11, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants