Running the simple sketch below on Android I keep getting “The pixels array is null.” error. The error does not happen when I use Java mode on my computer. From what I’ve read this error is usually caused by a missing loadPixels() but I understand I should only be using that when I’m actually working on the pixels array and this isn’t. Adding loadPixels() does not fix the issue in any case. setTexture() seems to be the issue but the texture loads and displays just fine. Is there something I’m missing here - a Android permission, a library I should be loading?
//radius of sphere
float sphereradius = 100;
//the sphere shape
PImage thetexture;
PShape thesphere;
//when the app first runs
void setup()
{
//set fullscreen, 3D mode and portrait
fullScreen(P3D);
orientation(PORTRAIT);
//load an image
thetexture = loadImage("red-chevron.jpg");
//disable stroke
noStroke();
//create a sphere shape and set the image as its texture
thesphere = createShape(SPHERE, sphereradius);
thesphere.setTexture(thetexture); //<-- the setTexture() causes the error
}
//the looping function of the app
void draw()
{
//set the background colour as green/blue (refresh the screen)
background(0, 200, 200);
//activate lights (shadow on sphere)
lights();
//translate to screen centre - this is used as the sphere's starting point (0, 0)
translate(width / 2, height / 2, 0);
//show sphere shape
shape(thesphere);
}