Jump to content

Drawing a hollow circle


nazariof
 Share

Recommended Posts

Hello Guys,

 

 

Has anyone got experience on drawing a hollow circle with Pixi?, my current approach only works in the WebGL renderer which makes me think it's flawed, and i also need to fallback to the other rendered for other devices.

 

this.mathPiDub = 2 * Math.PI;

this.color = 0xFF00FF

var nuRad = 10;

this.pixiCircle.beginFill(this.color, 1);
this.pixiCircle.arc(0, 0, nuRad - 2, 0, this.mathPiDub, false);
this.pixiCircle.arc(0, 0, nuRad, 0, this.mathPiDub, false);
this.pixiCircle.endFill();

 

The 2D rendered gives me a full circle while the WebGL cuts the hole through.

 

What's the best approach?

 

Thanks!.

Naz.

 

 

Link to comment
Share on other sites

Thanks for your  reply Rich.

I'm aware of there being a lineStroke but due to other reasons i need to achieve what i request which is totally possible in other Graphics APIs like in Flash and CreateJS.

 

It's all related to the  Path Winding, and the clockwise property of the arc function helps achieving this but i still can't manage to have it work properly.

 

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/GraphicsPathWinding.html

 

Link to comment
Share on other sites

You can do it with a standard canvas - http://stackoverflow.com/questions/8030069/how-to-draw-segment-of-a-donut-with-html5-canvas

Then generate a PIXI texture from that canvas.

 

The last time I tried to draw a hollow circle using pixi, it was buggy on some devices - https://github.com/GoodBoyDigital/pixi.js/issues/702

Maybe PIXI-s method of drawing circles and curves - triangulating them is not the optimal way and it would be better to do it with a fragment 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.

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...
 Share

  • Recently Browsing   0 members

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