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)

 

Thanks!

 

Karl

Link to post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...