Using geometry from PIXI.Graphics in PIXI.Mesh constructor

Recommended Posts

Hello !

My objective is to create geometry for meshes. until now I used quad so it wasn't too hard to model. Now I want to model some more complex shapes in 2D, polygons, cones etc. Since I'm familiar with the tools exposed in the PIXI.Graphics object, I thought to myself, "Hey! I'm going to draw a shape, and reuse the geometry contained in the Graphics object."

Here is my playground:

But after a few tests, it doesn't look so easy. What did I miss? Thanks for your help!

Share this post

Link to post
Share on other sites

Buffer is interleaved: graphcis uses same buffer for textures, uv's and colors. If it used different ones, it could work.

You can use same graphics geometry in your mesh, that should work.

Btw, just in case, UV's are made for texture 16x16 by default, so you'll have to scale them.

Share this post

Link to post
Share on other sites

Thank you Ivan!
I updated the playground by putting the Graphics geometry into the mesh and I updated the vertex shader with a quick hack for the UVs.

It works!
But... i can't specify the width and height of the mesh. It is tied to the graphics object. Other thing, I want my graphic object to be hidden (it is just serving for primitive drawing). Putting grapher.visible = false make the mesh to not render.

Share this post

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.

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.


  • Recently Browsing   0 members

    No registered users viewing this page.