mattdesl / mattdesl/google-panorama-equirectangular

WebGLRenderingContext's texImage2D and texSubImage2D question

Open
#8 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
188
Forks
28
PR merge metrics
No merged PRs in 30d

Description

Hello Mattdesl, I have a one question about WebGLRenderingContext's texImage2D and texSubImage2D function.
What I trying to create is something similar like loading image by tile by tile.

Here is my first function. It's working properly while it's first load. But whenever loading second time using same function but tiled background.
It failed. Look at the code below

// This is first load code which is working fine

```
gl.bindTexture(gl.TEXTURE_2D, handle)
gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null)

gl.bindTexture(gl.TEXTURE_2D, handle)
gl.texSubImage2D(gl.TEXTURE_2D, 0, x, y, gl.RGBA, gl.UNSIGNED_BYTE, image)
```

// This is second time using same but one different coding section [image data from canvas]. But it's not working.

```
gl.bindTexture(gl.TEXTURE_2D, handle)
gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, [image data from canvas])

gl.bindTexture(gl.TEXTURE_2D, handle)
gl.texSubImage2D(gl.TEXTURE_2D, 0, x, y, gl.RGBA, gl.UNSIGNED_BYTE, image)
```

Have you ever face the problem similar like me. Then please guide me to the light. Much appreciate it.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by comparing the two texImage2D and texSubImage2D snippets, focusing on the change from a null data argument to image data from canvas. Consult the WebGLRenderingContext texture-upload behavior and determine what causes the second tiled load to fail; done means identifying a reproducible correction or required missing context.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.