Jump to content

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: https://www.pixiplayground.com/#/edit/jGD8JtmKkkbseor6FklBg

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

Link to comment
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.

Link to comment
Share on other sites

  • 2 months later...

For this playground example https://www.pixiplayground.com/#/edit/jGD8JtmKkkbseor6FklBg
Is it possible to generate grapher.geometry without adding grapher to the stage?
In other words, I'm trying to figure out how to generate a geometry using drawing primitives (drawCircle, drawRect, lineTo)
so that I could use it to create a MESH with a shader. 


Link to comment
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.
  • Create New...