@@ -577,6 +577,7 @@ public PGraphicsOpenGL() {
577577
578578 PGL .glUsageRetained = PGL .DYNAMIC_DRAW ;
579579 PGL .glUsageImmediate = PGL .STATIC_DRAW ;
580+ PGL .glBufferAccess = PGL .READ_WRITE ;
580581
581582 polyAttribs = newAttributeMap ();
582583 inGeo = newInGeometry (this , polyAttribs , IMMEDIATE );
@@ -9482,7 +9483,7 @@ int getPointVertexSum(PVector v, int first, int last) {
94829483 // Buffer mapping methods
94839484
94849485 protected void mapPolyVerticesBuffer () {
9485- polyVerticesBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asFloatBuffer ();
9486+ polyVerticesBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asFloatBuffer ();
94869487 }
94879488
94889489 protected void initPolyVerticesBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -9537,18 +9538,18 @@ protected void copyPolyVertices(int offset, int size) {
95379538 }
95389539
95399540 protected void mapPolyColorsBuffer () {
9540- polyColorsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9541+ polyColorsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
95419542 }
95429543
95439544 protected void initPolyColorsBuffer (boolean onlymap , boolean unmap , int usage ) {
95449545 PGL pgl = pg .pgl ;
95459546 int sizei = polyVertexCount * PGL .SIZEOF_INT ;
95469547 if (bufObjStreaming ) {
95479548 if (onlymap ) {
9548- polyColorsBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9549+ polyColorsBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
95499550 } else {
95509551 pgl .bufferData (PGL .ARRAY_BUFFER , sizei , null , usage );
9551- polyColorsBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9552+ polyColorsBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
95529553 updatePolyColorsBuffer ();
95539554 }
95549555 if (unmap ) {
@@ -9592,7 +9593,7 @@ protected void copyPolyColors(int offset, int size) {
95929593 }
95939594
95949595 protected void mapPolyNormalsBuffer () {
9595- polyNormalsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asFloatBuffer ();
9596+ polyNormalsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asFloatBuffer ();
95969597 }
95979598
95989599 protected void initPolyNormalsBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -9647,7 +9648,7 @@ protected void copyPolyNormals(int offset, int size) {
96479648 }
96489649
96499650 protected void mapPolyTexCoordsBuffer () {
9650- polyTexCoordsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asFloatBuffer ();
9651+ polyTexCoordsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asFloatBuffer ();
96519652 }
96529653
96539654 protected void initPolyTexCoordsBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -9702,18 +9703,18 @@ protected void copyPolyTexCoords(int offset, int size) {
97029703 }
97039704
97049705 protected void mapPolyAmbientBuffer () {
9705- polyAmbientBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9706+ polyAmbientBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
97069707 }
97079708
97089709 protected void initPolyAmbientBuffer (boolean onlymap , boolean unmap , int usage ) {
97099710 PGL pgl = pg .pgl ;
97109711 int sizei = polyVertexCount * PGL .SIZEOF_INT ;
97119712 if (bufObjStreaming ) {
97129713 if (onlymap ) {
9713- polyAmbientBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9714+ polyAmbientBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
97149715 } else {
97159716 pgl .bufferData (PGL .ARRAY_BUFFER , sizei , null , usage );
9716- polyAmbientBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9717+ polyAmbientBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
97179718 updatePolyAmbientBuffer ();
97189719 }
97199720 if (unmap ) {
@@ -9757,18 +9758,18 @@ protected void copyPolyAmbient(int offset, int size) {
97579758 }
97589759
97599760 protected void mapPolySpecularBuffer () {
9760- polySpecularBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9761+ polySpecularBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
97619762 }
97629763
97639764 protected void initPolySpecularBuffer (boolean onlymap , boolean unmap , int usage ) {
97649765 PGL pgl = pg .pgl ;
97659766 int sizei = polyVertexCount * PGL .SIZEOF_INT ;
97669767 if (bufObjStreaming ) {
97679768 if (onlymap ) {
9768- polySpecularBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9769+ polySpecularBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
97699770 } else {
97709771 pgl .bufferData (PGL .ARRAY_BUFFER , sizei , null , usage );
9771- polySpecularBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9772+ polySpecularBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
97729773 updatePolySpecularBuffer ();
97739774 }
97749775 if (unmap ) {
@@ -9812,18 +9813,18 @@ protected void copyPolySpecular(int offset, int size) {
98129813 }
98139814
98149815 protected void mapPolyEmissiveBuffer () {
9815- polyEmissiveBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9816+ polyEmissiveBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
98169817 }
98179818
98189819 protected void initPolyEmissiveBuffer (boolean onlymap , boolean unmap , int usage ) {
98199820 PGL pgl = pg .pgl ;
98209821 int sizei = polyVertexCount * PGL .SIZEOF_INT ;
98219822 if (bufObjStreaming ) {
98229823 if (onlymap ) {
9823- polyEmissiveBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9824+ polyEmissiveBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
98249825 } else {
98259826 pgl .bufferData (PGL .ARRAY_BUFFER , sizei , null , usage );
9826- polyEmissiveBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9827+ polyEmissiveBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
98279828 updatePolyEmissiveBuffer ();
98289829 }
98299830 if (unmap ) {
@@ -9867,18 +9868,18 @@ protected void copyPolyEmissive(int offset, int size) {
98679868 }
98689869
98699870 protected void mapPolyShininessBuffer () {
9870- polyShininessBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asFloatBuffer ();
9871+ polyShininessBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asFloatBuffer ();
98719872 }
98729873
98739874 protected void initPolyShininessBuffer (boolean onlymap , boolean unmap , int usage ) {
98749875 PGL pgl = pg .pgl ;
98759876 int sizei = polyVertexCount * PGL .SIZEOF_FLOAT ;
98769877 if (bufObjStreaming ) {
98779878 if (onlymap ) {
9878- polyShininessBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asFloatBuffer ();
9879+ polyShininessBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asFloatBuffer ();
98799880 } else {
98809881 pgl .bufferData (PGL .ARRAY_BUFFER , sizei , null , usage );
9881- polyShininessBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asFloatBuffer ();
9882+ polyShininessBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asFloatBuffer ();
98829883 updatePolyShininessBuffer ();
98839884 }
98849885 if (unmap ) {
@@ -9923,11 +9924,11 @@ protected void copyPolyShininess(int offset, int size) {
99239924
99249925 protected void mapPolyAttribBuffer (VertexAttribute attrib ) {
99259926 if (attrib .type == PGL .FLOAT ) {
9926- polyAttribBuffers .put (attrib .name , pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asFloatBuffer ());
9927+ polyAttribBuffers .put (attrib .name , pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asFloatBuffer ());
99279928 } else if (attrib .type == PGL .INT ) {
9928- polyAttribBuffers .put (attrib .name , pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ());
9929+ polyAttribBuffers .put (attrib .name , pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ());
99299930 } else if (attrib .type == PGL .BOOL ) {
9930- polyAttribBuffers .put (attrib .name , pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ));
9931+ polyAttribBuffers .put (attrib .name , pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ));
99319932 }
99329933 }
99339934
@@ -9985,7 +9986,7 @@ protected void copyPolyAttribs(VertexAttribute attrib, int offset, int size) {
99859986 }
99869987
99879988 protected void mapPolyIndicesBuffer () {
9988- polyIndicesBuffer = pg .pgl .mapBuffer (PGL .ELEMENT_ARRAY_BUFFER , PGL .WRITE_ONLY ).asShortBuffer ();
9989+ polyIndicesBuffer = pg .pgl .mapBuffer (PGL .ELEMENT_ARRAY_BUFFER , PGL .glBufferAccess ).asShortBuffer ();
99899990 }
99909991
99919992 protected void initPolyIndicesBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10021,7 +10022,7 @@ protected void copyPolyIndices(int usage) {
1002110022 }
1002210023
1002310024 protected void mapLineVerticesBuffer () {
10024- lineVerticesBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asFloatBuffer ();
10025+ lineVerticesBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asFloatBuffer ();
1002510026 }
1002610027
1002710028 protected void initLineVerticesBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10076,7 +10077,7 @@ protected void copyLineVertices(int offset, int size) {
1007610077 }
1007710078
1007810079 protected void mapLineColorsBuffer () {
10079- lineColorsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
10080+ lineColorsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
1008010081 }
1008110082
1008210083 protected void initLineColorsBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10131,7 +10132,7 @@ protected void copyLineColors(int offset, int size) {
1013110132 }
1013210133
1013310134 protected void mapLineDirectionsBuffer () {
10134- lineDirectionsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asFloatBuffer ();
10135+ lineDirectionsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asFloatBuffer ();
1013510136 }
1013610137
1013710138 protected void initLineDirectionsBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10186,7 +10187,7 @@ protected void copyLineDirections(int offset, int size) {
1018610187 }
1018710188
1018810189 protected void mapLineIndicesBuffer () {
10189- lineIndicesBuffer = pg .pgl .mapBuffer (PGL .ELEMENT_ARRAY_BUFFER , PGL .WRITE_ONLY ).asShortBuffer ();
10190+ lineIndicesBuffer = pg .pgl .mapBuffer (PGL .ELEMENT_ARRAY_BUFFER , PGL .glBufferAccess ).asShortBuffer ();
1019010191 }
1019110192
1019210193 protected void initLineIndicesBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10222,7 +10223,7 @@ protected void copyLineIndices(int usage) {
1022210223 }
1022310224
1022410225 protected void mapPointVerticesBuffer () {
10225- pointVerticesBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asFloatBuffer ();
10226+ pointVerticesBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asFloatBuffer ();
1022610227 }
1022710228
1022810229 protected void initPointVerticesBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10277,7 +10278,7 @@ protected void copyPointVertices(int offset, int size) {
1027710278 }
1027810279
1027910280 protected void mapPointColorsBuffer () {
10280- pointColorsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
10281+ pointColorsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
1028110282 }
1028210283
1028310284 protected void initPointColorsBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10332,7 +10333,7 @@ protected void copyPointColors(int offset, int size) {
1033210333 }
1033310334
1033410335 protected void mapPointOffsetsBuffer () {
10335- pointOffsetsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asFloatBuffer ();
10336+ pointOffsetsBuffer = pg .pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asFloatBuffer ();
1033610337 }
1033710338
1033810339 protected void initPointOffsetsBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10387,7 +10388,7 @@ protected void copyPointOffsets(int offset, int size) {
1038710388 }
1038810389
1038910390 protected void mapPointIndicesBuffer () {
10390- pointIndicesBuffer = pg .pgl .mapBuffer (PGL .ELEMENT_ARRAY_BUFFER , PGL .WRITE_ONLY ).asShortBuffer ();
10391+ pointIndicesBuffer = pg .pgl .mapBuffer (PGL .ELEMENT_ARRAY_BUFFER , PGL .glBufferAccess ).asShortBuffer ();
1039110392 }
1039210393
1039310394 protected void initPointIndicesBuffer (boolean onlymap , boolean unmap , int usage ) {
0 commit comments