Processing Forum
PGraphicsOpenGL mainGL; // the main screenPGL pgl; // make raw GL calls here
mainGL = (PGraphicsOpenGL)g;pgl = mainGL.beginPGL();
int numVerts = 32;float[] verts = new float[numVerts*2]; //xyxyxyxyxyxyfor(int i = 0; i < verts.length; i++){verts[i] = random(512.0);}
FloatBuffer vertexBuffer = FloatBuffer.wrap(verts);
int[] vboIDs = new int[1];pgl.glGenBuffers(1, vboIDs, 0);pgl.glBindBuffer(pgl.GL_ARRAY_BUFFER, vboIDs[0]);pgl.glBufferData(pgl.GL_ARRAY_BUFFER, numVerts*2*4, vertexBuffer, pgl.GL_STATIC_DRAW);
pgl.glBindBuffer(pgl.GL_ARRAY_BUFFER, vboIDs[0]);pgl.glVertexAttribPointer(0, 2, pgl.GL_FLOAT, false, numVerts*2*4, 0);pgl.glEnableVertexAttribArray(0);
mainGL.endPGL();