Skip to content

Conversation

@gero3
Copy link
Contributor

@gero3 gero3 commented Sep 25, 2019

A followup on #17550 (comment).

This adds defaults to DataTexture2DArray & DataTexture3D.

@gero3 gero3 changed the title Add default to textures Texture: Add defaults to textures. Sep 25, 2019
@EliasHasle
Copy link
Contributor

EliasHasle commented Sep 26, 2019

Quoting the WebGL 2 specification:

void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, ArrayBufferView? srcData)

void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, ArrayBufferView srcData, GLuint srcOffset) (OpenGL ES 3.0.4 §3.8.4, man page)

Allocates and initializes the specified mipmap level of a three-dimensional or two-dimensional array texture.

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

If srcData is null, a buffer of sufficient size initialized to 0 is passed.

So this should be right, for the same reasons it was (should be) right with DataTexture.

Resolved I am a bit scared by this line, though. I cannot (using GitHub search) find any place where `texture.image.complete` is set, for _any_ type of texture. Then I would guess it is done outside three.js, but that cannot be the case for `DataTexture`, right? Edit: Ah, it checks for `image.complete === false`, not for `! image.complete`. Then `image.complete === undefined` skips the block. OK! `image.complete` is presumably used, or at least intended for use, when using images before they are completely loaded (although I find no mentions in either `TextureLoader` or `ImageLoader`).

@Mugen87 Mugen87 added this to the r109 milestone Sep 26, 2019
@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 27, 2019

Merging this one for consistency and testing on dev.

@Mugen87 Mugen87 merged commit 8bbea97 into mrdoob:dev Sep 27, 2019
@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 27, 2019

Updated builds: cfdfcd7

@mrdoob
Copy link
Owner

mrdoob commented Sep 27, 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.

4 participants