Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p5/ Skia in Pycharm rendering just a black screen #424

Closed
KnightRider3508 opened this issue Feb 22, 2023 · 15 comments
Closed

p5/ Skia in Pycharm rendering just a black screen #424

KnightRider3508 opened this issue Feb 22, 2023 · 15 comments

Comments

@KnightRider3508
Copy link

New to Github, p5, sorry if I missed something

Describe the bug
trying to use skia as the renderer however it is not drawing I added background to end of draw to circumvent bug putting it in setup. Works properly in visper but not skia see screenshots for reference.

To Reproduce
from p5 import *

circlex = 200

def setup():
size(400, 300)

def draw():
global circlex
no_stroke()
fill(255)
circle(circlex, 150, 24)
background(0)

run(renderer="skia")

Expected behavior
White circle drawn at 200, 150

Screenshots
Screenshot (18)

Screenshot (19)

System information:

  • p5: 0.8.2
  • Python version: 3.10.10
  • Operating system: W10

Additional context
Add any other context about the problem here.

@github-actions
Copy link
Contributor

Thank you for submitting your first issue to p5py

@tushar5526
Copy link
Member

You are calling background(0) at the end, which basically means to set everything to black. Move this to the top in draw()

@KnightRider3508
Copy link
Author

KnightRider3508 commented Feb 22, 2023

Thank you for taking time to help with my issue. I really look forward to this application in python. That is originally how I had it. However that doesn't work If I just try drawing a white BG it doesn't render it. Size of canvas does change if I change size param.

from p5 import *

def setup():
size(400, 300)

def draw():
background(255)

run(renderer="skia")

Screenshot (21)

@KnightRider3508
Copy link
Author

Here is a screenshot of my packages I have in my env in case something doesn't look right
Screenshot (22)

@KnightRider3508
Copy link
Author

Resolved by using run(renderer='skia') instead of run(renderer="skia")

@smlpt
Copy link

smlpt commented Mar 5, 2023

@tushar5526 Can you reopen this issue? Because I've just run into the same problem of getting a black screen with skia.

example code:

from p5 import *

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

def draw():
    background(128)
    fill(255)
    circle((width/2, height/2), 256)


run(renderer='skia')

P5 runs in a virtual environment with all the packages installed that come with the P5 library.

Vispy:
image
Skia:
image

(The size disparity in window sizes seems to be a scaling issue from Windows; I dragged the P5 window onto my second monitor to take the screenshot.)

Is there something obvious I'm missing or is this maybe a bug in P5 related to skia?

@tushar5526
Copy link
Member

Hey, this is fixed by #420. Try installing git from github directly, a new release is not made yet.

@smlpt
Copy link

smlpt commented Mar 5, 2023

Hey, this is fixed by #420. Try installing git from github directly, a new release is not made yet.

Thanks for the quick answer. I tried pip install git+https://github.com/p5py/p5.git#egg=p5 but nothing changed. Is there a specific branch that I should install?

@tushar5526
Copy link
Member

Possibly related to #425 Can you try removing size() function from the setup and try again?

@tushar5526 tushar5526 reopened this Mar 7, 2023
@smlpt
Copy link

smlpt commented Mar 7, 2023

Yes, this seems to work indeed. Interesting bug.

@tushar5526
Copy link
Member

Yes, this seems to work indeed. Interesting bug.

#399 is the cause majorly

@paul-morenkov
Copy link

paul-morenkov commented Jun 4, 2023

Possibly related to #425 Can you try removing size() function from the setup and try again?

So is it not possible to have a different size canvas with the skia renderer currently?

@tushar5526
Copy link
Member

Possibly related to #425 Can you try removing size() function from the setup and try again?

So is it not possible to have a different size canvas with the skia renderer currently?

It is possible - You can set the size in draw() when frame_rate == 1. I have not got the chance to work on the fix yet.

@tushar5526
Copy link
Member

tushar5526 commented Nov 17, 2023

Hey folks, I finally sat down to put out a fix for this. It should be solved now by #446. The weird behaviour is majorly due to the swapping of buffers. Tested it on my local and seems to be working fine.

Closing the issue now :)

@smlpt
Copy link

smlpt commented Nov 17, 2023

Can confirm that it works on my side 👍
Thanks a lot for your effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants