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

Error: WebGL warning: readPixels: Incompatible format or type. #47

Open
webciter opened this issue Apr 9, 2018 · 1 comment
Open

Error: WebGL warning: readPixels: Incompatible format or type. #47

webciter opened this issue Apr 9, 2018 · 1 comment

Comments

@webciter
Copy link

webciter commented Apr 9, 2018

Error: WebGL warning: readPixels: Incompatible format or type. When using the getPixelArray(). I need the function getImageData() from the context how can i get this.

@Zaphiruz
Copy link

Zaphiruz commented Jun 6, 2018

I was having the same issue and got around it using this

// this.canvas is the canvas created with glfx

getPixels() {
		let texture = this.canvas._.texture,
			gl = texture.gl,
			size = texture.width * texture.height * 4,
			pixels = new Uint8Array(size);
			
		texture.use();
		gl.defaultShader.drawRect();
		gl.readPixels(0, 0, texture.width, texture.height, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
		
		return pixels;
	}

i used chunks of the source code from Canvas.toImage

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

2 participants