We are about to switch to a new forum software. Until then we have removed the registration on this forum.
The first is about triangle strips. When I try to draw one it gives me the message: "Only GROUP, PShape.PATH, and PShape.GEOMETRY work with createShape()" for something like:
void setup(){
size(1080,720,P3D);
}
void draw(){
stroke(255);
fill(255,0,0);
createShape(TRIANGLE_STRIP);
vertex(-100,0,100);
vertex(-100,0,-100);
vertex(100,0,100);
vertex(100,0,-100);
endShape(CLOSE);
}
The second is about texture mapping. I am trying to put an image onto a sphere but also have other shapes that rely on fill(). I tried putting the fill in pushmatrix and popmatrix but it fills the globe anyway.
import peasy.*;
PeasyCam cam;
PImage img;
PShape globe;
void setup(){
cam = new PeasyCam(this,700);
img = loadImage("starmap_8k.jpg");
size(1080,720,P3D);
}
void draw(){
pushMatrix();
fill(255,0,0);
popMatrix();
globe=createShape(SPHERE,4000);
globe.setTexture(img);
noStroke();
shape(globe);
}
Answers
First
look at reference createShape and beginShape
Second
pushMartix/popMatrix doesn't isolate colors, only the Matrix
better define globe in setup()