Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGLRenderingContext's texImage2D and texSubImage2D question #8

Open
MOLTogCHIN opened this issue Aug 29, 2016 · 0 comments
Open

WebGLRenderingContext's texImage2D and texSubImage2D question #8

MOLTogCHIN opened this issue Aug 29, 2016 · 0 comments

Comments

@MOLTogCHIN
Copy link

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.

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

No branches or pull requests

1 participant