Please Help: Issue with 3D

hi guys can anyone help me out please im sorta really stuck. im trying to draw a sphere onto processing but anytime i use P3D, the display image is just grey and blank. does anyone know why?

1 Like

Hello,

Reference for sphere():
sphere() \ Language (API) \ Processing 3+

Check out the related reference as well for an example with setup() and draw().

The tutorial also has sphere examples:
P3D \ Processing.org

:)

Hello! So I’ve tried using the references and it doesn’t seem to work either way. I still get the same result. Whenever I run the program, I only get a blank, grey square

1 Like

Please post your entire code

For example with sphere say noStroke(); before and
lights(); and fill(255,0,0); before

and sphere(100);

You might have clipping issues

Or the sphere is behind the camera

Chrisir

Hello, so this is the code I have. But the issue is, even when I used the references on the processing website, I still get the same result, and I’m not sure why

def setup(): 
    size(800, 600, P3D)
    translate(400, 300)
    sphere(100)
    
    lights()
    
    background('#004477')
    
    pushMatrix()
    translate(600,300)
    sphere(100)
    popMatrix()
    
    pushMatrix()
    translate(200,300)

    popMatrix()

You did not fill() your sphere().
And background() after sphere covered over it.

:)

2 Likes

Please use setup AND draw

Also comment out background and translate

So for the draw function, would I put in the push and pop matrix there?

Yes all drawing is in draw

Read this:
background() \ Language (API) \ Processing 3+

about where background usually goes.

Same applies to python… I changed the category to Processing.py

:)

1 Like

So this is the code I have, yet I still have the same issue occurring again. Is this an issue with processing itself?

def setup(): 
    size(800, 600, P3D)
    background('#004477')
    translate(400, 300)
    fill('#FFFFFF')
    sphere(100)
    
    lights()

def draw():
    pushMatrix()
    translate(600,300)
    sphere(100)
    popMatrix()
    
    pushMatrix()
    translate(200,300)

    popMatrix()


The image above is what shows

Comment out the translate

Yup, just did. I still get the same issue :frowning:

1 Like
    size(800, 600, P3D)
    background(0)
    
    fill(255,0,0)
    sphere(100)

So I tried this, and I still get the blank, grey screen.

1 Like

Ok and same minimal with sphere (10);

Or are you on Mac Big Sur

1 Like

Yeah, I just checked and it is Mac Big Sur. Do you have any clue on how to work around it?

You may want to consider this:

Do so at your own risk… I have no experience with this.

You may want to ask in the forum if this is a solution for others.

:)

when you can use p5.js (instead of python):

check the online editor:

see https://editor.p5js.org/