Jump to content

Access raw webgl from phaser


karlz
 Share

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)

 

Thanks!

 

Karl

Link to comment
Share on other sites

update:

 

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

 

http://www.html5gamedevs.com/topic/4183-mixing-in-3d-elements/

http://dscode.cf/?p=1

 

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:

http://codepen.io/anon/pen/vNaxEG

 

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!

 

karl

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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