Hi @NokFrt ,
Check this post:
Hi @heretique ,
Yes, correct, you should be using readPixels, not aware of any other way. Here is how I do this:
const readPixelsFromTexture = function (texture) {
const app = this.app;
// make a framebuffer
const gl = app.graphicsDevice.gl;
const fb = gl.createFramebuffer();
// make this the current frame buffer
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
// attach the texture to the framebuffer.
gl.framebufferTexture2D(
gl.FRAMEBUFFER, gl.COLOR_ATTACHME…
There is also support for this added in the engine recently. I think it’s merged, though I’m not aware of a public example on how to use it. @slimbuck @mvaligursky any idea?
playcanvas:main
← slimbuck:texture-async-read
opened 04:31PM - 15 May 23 UTC
This PR:
- organises pixel format metadata declarations slightly
- updates `Te… xture.lock()` to work correctly when specifying level and cubemap face
- add support for asynchronously reading texture data from graphics memory
- add a helper function for forcing lost context to `WebglGraphicsDevice` called `debugLoseContext()`.