Git Product home page Git Product logo

Comments (13)

pikeas avatar pikeas commented on May 30, 2024 1

Ditto. Pixelated circles on a Retina display with p5 0.6.0, with both @marcrleonard's and @parsoyaarihant's snippets.

from p5.

abhikpal avatar abhikpal commented on May 30, 2024

We manually tessellate a shape before drawing it, this could be causing the issue. Ideally this should be done in OpenGL, but we were already facing many issues with OpenGL so just decided to do it manually.

Two more things:

  • I don't understand enough OpenGL myself to take this on, but would love if someone familiar with OpenGL would like to work on this.
  • Could someone also try and reproduce this, please?

from p5.

marcrleonard avatar marcrleonard commented on May 30, 2024

I don't know opengl either... This is the best I got :-)
https://www.opengl.org/discussion_boards/showthread.php/167955-drawing-a-smooth-circle

from p5.

marcrleonard avatar marcrleonard commented on May 30, 2024

I'm wondering if you couldn't drill into the pygame code to get the opengl pieces for arc/circle/ellipse etc...

from p5.

illus0r avatar illus0r commented on May 30, 2024

Could someone also try and reproduce this, please?

Mac OS, retina display, chunky edges:
image

But I'll give your lib a whirl, it looks fascinating after Pillow and p5.js :–)

Let me know if you need some Mac OS testing.

from p5.

arihantparsoya avatar arihantparsoya commented on May 30, 2024

I am also getting the same error. I am using MacBook Pro (without retina display - 1920x1080).

But, I think this behaviour is occurring because the background is not cleared at every frame. This is discussed in Processing forum too:

constantly redrawing the same object over itself means that the pixels with partial alpha, the ones on the edges drawn that way to help smooth out the object, get less and less transparent with each frame. meaning you lose the smoothing.

When the background is cleared at every frame, the circles appear smoother. I have observed this behaviour while rendering SVGs in browser too. Redrawing the same SVG multiple times makes the edges of SVG look chunky in browser.

@illus0r could you try the following code and check if the edges are still chunky?:

from p5 import *

def setup():
    size(500, 500)
    no_stroke()
    background(204)

def draw():
    background(204)
    fill(random_uniform(255), random_uniform(127), random_uniform(51), 127)
    circle((mouse_x, mouse_y), 40)

run()

from p5.

marynelv avatar marynelv commented on May 30, 2024

I'm getting the same chunky (aliased) result in Ubuntu. Clearing the background doesn't help.

from p5.

abey79 avatar abey79 commented on May 30, 2024

Same here. macOS Mojave and p5==0.5.0. Retina display (MacBook Pro 2018).

image

from p5.

PaulNicolasHunter avatar PaulNicolasHunter commented on May 30, 2024

Hi, is there any follow up to this?
I could it be because smooth() hasn't been implemented and things are left for default anti-aliasing?

from p5.

jeremydouglass avatar jeremydouglass commented on May 30, 2024

Several of these examples actually call mouse_is_pressed multiple times on a single click at 60fps, so they aren't so great for testing because they can write stacked circles (although the randomized width helps. Here is a simpler test:

from p5 import *

def setup():
    size(640, 360)
    no_stroke()

def draw():
    background(204)
    fill(192,64,128)
    circle((width/2, height/2), 32)

if __name__ == '__main__':
    run()

I can confirm on a retina display with p5 0.6.0 that the resulting circle has the correct size -- it is "32x32", and if you drag a desktop screenshot you get a 74x74 png (because retina), in which the circle is made of 2x2 pixels (because that's the size of the underlying pixel buffer in p5). This is all expected -- the "chunky" part that might be unexpected is the no anti-aliasing / smooth.

Screen Shot 2020-04-25 at 10 34 18 AM

from p5.

ReneTC avatar ReneTC commented on May 30, 2024

Same problem with stroke

def setup():
    size(1280, 720)


def draw():
    background(0)
    translate(1280/2, 720/2)
    stroke(255)
    stroke_weight(30)
    line((0,0),(1280,720))

if __name__ == '__main__':
   run()

Results in:

image

from p5.

sanchopanza35 avatar sanchopanza35 commented on May 30, 2024

So are there any update for this?

from p5.

tushar5526 avatar tushar5526 commented on May 30, 2024

@sanchopanza35 #212

from p5.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.