I'm trying to make a plugin to use three.js for 3D rendering with construct 2.
Right now i have everything working so that i can render onto a separate canvas element on the page, and copy that content onto a texture construct can use.
Because the way construct draws is pretty undocumented and i'm new to javascript i'm having difficulty understanding how i can efficiently pass the texture from the other canvas onto the "c2canvas" without significant slowdown.
right now i'm using:
this.webGL_texture = this.runtime.glwrap.loadTexture(MYCANVAS, true, this.runtime.linearSampling, this.texture_pixelformat); etc.
and rendering webGL_texture using glw.quad(). All this stuff is currently working as intended but it's very slow to copy a screen sized image into memory every frame, and it's not a usable solution.
The problem im having is that i don't know a more efficient way to do this. Using three.js i'm able to render to a texture as well, but the method of doing this produces an object defined by three.js that contains the texture which is also pretty undocumented, and i have no clue how to get this texture to a form construct can use.
some information on how construct 2 handles webGL textures so i can interface the two systems might prove insightful, or perhaps a better way to transfer the contents of the other canvas to a texture for construct to render.
Would i be better off just laying my three.js canvas below the c2canvas, and save the overhead of passing anything? Maybe i'm doing things right but something is going wrong somewhere? i've been looking at R0J0hound 's paster to see how he grabbed the content of sprites but it seems hes just calling their draw function.
I'd be grateful for any insight as im just scratching my head with this right now.