processing / processing/processing4
noStroke makes PShape.setTexture crash (P2D)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 494
- Forks
- 183
- Ø Merge
- 4 Std. 39 Min.
- Gemergte PRs (30 T.)
- 3
Beschreibung
Created by: TidensBarn
I had inexplicable crashes when using textures on PShapes that almost made me loose my will to live until I finally found the cause:
If I create a PShape in "noStroke" state, setTexture will work the first time, but when I then try to set a different texture and redraw, it'll crash:
PShape shape;
void settings() {
size(400, 400, P2D);
}
void setup() {
}
void draw() {
noStroke(); // Remove this, no crash
shape = createShape(RECT, 0, 0, 200, 200);
PImage p1 = loadImage("img1.png");
shape.setTexture(p1);
shape(shape);
PImage p2 = loadImage("img2.png"); // p2 needs to be a different size from p1
shape.setTexture(p2);
shape(shape); // Crash!
}
It's an ArrayIndexOutofBoundsException in PShapeOpenGL, line 843, because the field "firstLineVertex" happens to be -1...
Here's a sketch with images: crash.zip
Tested on Win 10, Processing 4.2
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der bereitgestellten Absturzskizze und untersuche PShapeOpenGL um Zeile 843, wo für firstLineVertex -1 gemeldet wird. Reproduziere den Fehler in P2D mit noStroke(), ersetze dann die Textur einer Form durch ein Bild mit einer anderen Größe und zeichne sie erneut. Als abgeschlossen gilt die Aufgabe, wenn diese Sequenz nicht mehr abstürzt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- computer-graphics
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100