Jump to content

Access raw webgl from phaser


Recommended Posts

Hi i just started with phaser and thought it would be cool to mix in some 3d overlays for certain elements. Is it possible to render uv mapped meshes using phaser? I tried to pass the gl context (game.renderer.gl) to a function that does some raw webgl operations, but it bails out with the message: "INVALID_OPERATION: uniform2f: location not for current program", which seems pixi related? (https://github.com/pixijs/pixi.js/issues/181)





Link to comment
Share on other sites



i found a post explaining how to do what i want for three.js and phaser, by hooking a canvas to a pixi texture:





With the help of this article i cooked up a minimal example that draws a triangle in a "raw" webgl context which can then be used as a sprite in the phaser world:



While this works i noticed the animation is not smooth... i have the suspicion that this method causes the "backbuffer-canvas" in my example to be uploaded back to the gpu every frame phaser renders.. can anybody with more knowledge about how this canvas to pixi binding works confirm this? Is there any way to have this setup but keep the "backbuffer-canvas" as texture on the gpu?


Thanks in advance!



Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...