From cecf24df8cad39ef627ba0d656bcf73811685532 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Sat, 22 Jan 2022 17:24:47 -0500 Subject: [PATCH] Map buffer with correct type according to attrib type --- core/src/processing/opengl/PGraphicsOpenGL.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 98d0264eb..92ff321e8 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -9920,7 +9920,13 @@ public class PGraphicsOpenGL extends PGraphics { } protected void mapPolyAttribBuffer(VertexAttribute attrib) { - polyAttribBuffers.put(attrib.name, pg.pgl.mapBuffer(PGL.ARRAY_BUFFER, PGL.WRITE_ONLY).asFloatBuffer()); + if (attrib.type == PGL.FLOAT) { + polyAttribBuffers.put(attrib.name, pg.pgl.mapBuffer(PGL.ARRAY_BUFFER, PGL.WRITE_ONLY).asFloatBuffer()); + } else if (attrib.type == PGL.INT) { + polyAttribBuffers.put(attrib.name, pg.pgl.mapBuffer(PGL.ARRAY_BUFFER, PGL.WRITE_ONLY).asIntBuffer()); + } else if (attrib.type == PGL.BOOL) { + polyAttribBuffers.put(attrib.name, pg.pgl.mapBuffer(PGL.ARRAY_BUFFER, PGL.WRITE_ONLY)); + } } protected void initPolyAttribsBuffer(VertexAttribute attrib, boolean onlymap, boolean unmap, int usage) {