Skip to content

Commit 717fe55

Browse files
committed
correct size value for line/point indices
1 parent 76641b6 commit 717fe55

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

java/libraries/lwjgl/src/processing/lwjgl/PGraphicsLWJGL.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,9 +1255,9 @@ protected void updateLineBuffers() {
12551255

12561256
tessGeo.prepareLineIndicesForCopy();
12571257

1258-
int sizex = size * PGL.SIZEOF_INDEX;
12591258
pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glLineIndexBufferID);
1260-
pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, sizex, tessGeo.lineIndices, vboMode);
1259+
pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, tessGeo.lineIndexCount * PGL.SIZEOF_INDEX,
1260+
tessGeo.lineIndices, vboMode);
12611261
}
12621262

12631263
protected void unbindLineBuffers() {
@@ -1323,9 +1323,9 @@ protected void updatePointBuffers() {
13231323

13241324
tessGeo.preparePointIndicesForCopy();
13251325

1326-
int sizex = size * PGL.SIZEOF_INDEX;
13271326
pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glPointIndexBufferID);
1328-
pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, sizex, tessGeo.pointIndices, vboMode);
1327+
pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, tessGeo.pointIndexCount * PGL.SIZEOF_INDEX,
1328+
tessGeo.pointIndices, vboMode);
13291329
}
13301330

13311331
protected void unbindPointBuffers() {

java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,9 +1255,9 @@ protected void updateLineBuffers() {
12551255

12561256
tessGeo.prepareLineIndicesForCopy();
12571257

1258-
int sizex = size * PGL.SIZEOF_INDEX;
12591258
pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glLineIndexBufferID);
1260-
pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, sizex, tessGeo.lineIndices, vboMode);
1259+
pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, tessGeo.lineIndexCount * PGL.SIZEOF_INDEX,
1260+
tessGeo.lineIndices, vboMode);
12611261
}
12621262

12631263
protected void unbindLineBuffers() {
@@ -1323,9 +1323,9 @@ protected void updatePointBuffers() {
13231323

13241324
tessGeo.preparePointIndicesForCopy();
13251325

1326-
int sizex = size * PGL.SIZEOF_INDEX;
13271326
pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glPointIndexBufferID);
1328-
pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, sizex, tessGeo.pointIndices, vboMode);
1327+
pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, tessGeo.pointIndexCount * PGL.SIZEOF_INDEX,
1328+
tessGeo.pointIndices, vboMode);
13291329
}
13301330

13311331
protected void unbindPointBuffers() {
@@ -2281,8 +2281,9 @@ protected void renderPoints() {
22812281
protected void renderLines() {
22822282
if (!lineVBOsCreated) {
22832283
createLineBuffers();
2284-
lineVBOsCreated = true;
2284+
lineVBOsCreated = true;
22852285
}
2286+
22862287
updateLineBuffers();
22872288

22882289
LineShader shader = getLineShader();
@@ -2294,7 +2295,8 @@ protected void renderLines() {
22942295
pgl.glDrawElements(PGL.GL_TRIANGLES, tessGeo.lineIndexCount, PGL.INDEX_TYPE, 0);
22952296

22962297
shader.stop();
2297-
unbindLineBuffers();
2298+
2299+
unbindLineBuffers();
22982300
}
22992301

23002302

0 commit comments

Comments
 (0)