Create erasable surface


Okay, same line this time can’t read property precision of undefined


Please fix it by yourself. You have to use precision field from graphicsDevice.


Whoops, found that issue. Missed the line where I define graphics device and forgot to move it.


Nice. Does it work now?


Still not scratched if it’s supposed to be, and getting this until WebGl calls too many errors.
[.Offscreen-For-WebGL-0000012FC143BE90]GL ERROR :GL_INVALID_OPERATION : glBlitFramebufferCHROMIUM: src and dst formats differ for color


Try to remove

renderTarget.copy(tempRender, true);

Still errors?


Removing that fixed it.


Try to copy by device.copyRenderTarget instead of that function.


Actually, just removing true from the old function works to. I think the problem was that the color values were different between the two.


Because without both params it does nothing.



Okay, so just set to false then so it doesn’t copy those params.


But… You need to copy color! That’s why you use it.


Right, so what do you mean by device.copyRenderTarget, because that doesn’t seem to be a function.
I tried doing it as graphicsDevice.copyRenderTarget



It definitely is.


Trying that gives another massive loop of the same error. Debug for the editor says error loading scripts, and console says cannot read property _colorBuffer of undefined


Then there is something wrong with your textures. Try to make their width and height equal?


They are:

var opacity = new pc.Texture(graphicsDevice,
        width: 64,
        height: 32,
        format: pc.PIXELFORMAT_R8_G8_B8_A8
    var tempTexture = new pc.Texture(graphicsDevice,
        width: 64,
        height: 32,
        format: pc.PIXELFORMAT_R8_G8_B8_A8


I meant

width: 64,
height: 64,


Nope, no change there


I don’t know why.

Probably your textures wasn’t initialized. So you have to do it by hands, but it’s not public API though.

Try to set filters. Check example of RenderTarget for that.