Jump to content

Drawing/lineTo issues with PIXI.Graphics

Billy Williamton

Recommended Posts

I've recently been messing around with drawing onto graphics objects via mouse events. I was expecting lineTo to draw pixel by pixel but it doesnt seem to do that. I think its drawing half pixels. It''s especially noticable when drawing angles. I tried setting roundPixels to true, but it doesnt seem to affect this. I can set it to draw rectangles onto the x and y locations of the mouse event but the event cant keep up with quick movements of the cursor. Any help is appreciated.

Link to comment
Share on other sites

Telepath mode on.

Its either about

1. strokes. Yeah. Half-pixels, like in canvas2d. (0.5, 0.5) is the center of a pixel, if line width is 1 then it will take full pixel. (0,0) is the corner, and +-0.5 are in different pixels ;) Welcome to canvas world. Any platform, any engine, same s@#$.

2. your input is too close and one of algorithms inside https://github.com/pixijs/pixi.js/tree/dev/src/core/graphics thinks that two neighbour points are the same.

3. shader precision. Dont try coordinates like "1000000.5" , you'll lose precision and in iOS its pretty bad.

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