processing / processing/processing4
noStroke makes PShape.setTexture crash (P2D)
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 494
- 派生
- 183
- 平均合并
- 4 小时 39 分钟
- 30 天内合并 PR
- 3
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从提供的崩溃 sketch 开始,检查第 843 行附近的 PShapeOpenGL,其中报告 firstLineVertex 为 -1。使用 noStroke() 在 P2D 中重现该故障,然后将某个形状的纹理替换为尺寸不同的图像并重新绘制。完成的标准是这一序列不再导致崩溃。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- computer-graphics
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100