I wanted to create a sphere with texture on it. So I tried to make the image wrap around the sphere, but when I run the code, only the rotating sphere shows. Is there something wrong with the code?
img = loadImage('uranus.jpg')
r = 0;
z = 200;
translate(width/2, height/2, z)
Wheres your endShape() call to close the shape.
Hello, I just added it and it still only gives me the rotating sphere without the texture.
Are you sure you are translating to the right place?
Yes, so when I run the program, everything is according to plan except the texture doesn’t come
Just cooking atm and then have some shopping to do, will check in later.
Take at look at the Processing JAVA example (see last section) to give you a idea of how this is done in the JAVA version:
There is a reference in the PShape tutorial to the P3D tutorial which is available in JAVA and Python:
I did not find a Processing Python tutorial on PShapes.
Now adapt this to the Processing Python version.
Start simple and just texture the sphere first and add other code later.
This is a working Processing (JAVA) version:
size(300, 300, P3D);
img = loadImage("frog.png");
sph = createShape(SPHERE, 100);
shape(sph, width/2, height/2);
You will have to adapt this to Python; this is not difficult and I was able to do this in Python.
Reference to help with createShape() for Python:
The Processing JAVA and Python version had the same output:
The Processing resources are here:
And you can select Python from the menu along the top.