@@ -577,6 +577,7 @@ public PGraphicsOpenGL() {
577
577
578
578
PGL .glUsageRetained = PGL .DYNAMIC_DRAW ;
579
579
PGL .glUsageImmediate = PGL .STATIC_DRAW ;
580
+ PGL .glBufferAccess = PGL .READ_WRITE ;
580
581
581
582
polyAttribs = newAttributeMap ();
582
583
inGeo = newInGeometry (this , polyAttribs , IMMEDIATE );
@@ -9482,7 +9483,7 @@ int getPointVertexSum(PVector v, int first, int last) {
9482
9483
// Buffer mapping methods
9483
9484
9484
9485
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 ();
9486
9487
}
9487
9488
9488
9489
protected void initPolyVerticesBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -9537,18 +9538,18 @@ protected void copyPolyVertices(int offset, int size) {
9537
9538
}
9538
9539
9539
9540
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 ();
9541
9542
}
9542
9543
9543
9544
protected void initPolyColorsBuffer (boolean onlymap , boolean unmap , int usage ) {
9544
9545
PGL pgl = pg .pgl ;
9545
9546
int sizei = polyVertexCount * PGL .SIZEOF_INT ;
9546
9547
if (bufObjStreaming ) {
9547
9548
if (onlymap ) {
9548
- polyColorsBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9549
+ polyColorsBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
9549
9550
} else {
9550
9551
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 ();
9552
9553
updatePolyColorsBuffer ();
9553
9554
}
9554
9555
if (unmap ) {
@@ -9592,7 +9593,7 @@ protected void copyPolyColors(int offset, int size) {
9592
9593
}
9593
9594
9594
9595
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 ();
9596
9597
}
9597
9598
9598
9599
protected void initPolyNormalsBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -9647,7 +9648,7 @@ protected void copyPolyNormals(int offset, int size) {
9647
9648
}
9648
9649
9649
9650
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 ();
9651
9652
}
9652
9653
9653
9654
protected void initPolyTexCoordsBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -9702,18 +9703,18 @@ protected void copyPolyTexCoords(int offset, int size) {
9702
9703
}
9703
9704
9704
9705
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 ();
9706
9707
}
9707
9708
9708
9709
protected void initPolyAmbientBuffer (boolean onlymap , boolean unmap , int usage ) {
9709
9710
PGL pgl = pg .pgl ;
9710
9711
int sizei = polyVertexCount * PGL .SIZEOF_INT ;
9711
9712
if (bufObjStreaming ) {
9712
9713
if (onlymap ) {
9713
- polyAmbientBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9714
+ polyAmbientBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
9714
9715
} else {
9715
9716
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 ();
9717
9718
updatePolyAmbientBuffer ();
9718
9719
}
9719
9720
if (unmap ) {
@@ -9757,18 +9758,18 @@ protected void copyPolyAmbient(int offset, int size) {
9757
9758
}
9758
9759
9759
9760
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 ();
9761
9762
}
9762
9763
9763
9764
protected void initPolySpecularBuffer (boolean onlymap , boolean unmap , int usage ) {
9764
9765
PGL pgl = pg .pgl ;
9765
9766
int sizei = polyVertexCount * PGL .SIZEOF_INT ;
9766
9767
if (bufObjStreaming ) {
9767
9768
if (onlymap ) {
9768
- polySpecularBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9769
+ polySpecularBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
9769
9770
} else {
9770
9771
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 ();
9772
9773
updatePolySpecularBuffer ();
9773
9774
}
9774
9775
if (unmap ) {
@@ -9812,18 +9813,18 @@ protected void copyPolySpecular(int offset, int size) {
9812
9813
}
9813
9814
9814
9815
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 ();
9816
9817
}
9817
9818
9818
9819
protected void initPolyEmissiveBuffer (boolean onlymap , boolean unmap , int usage ) {
9819
9820
PGL pgl = pg .pgl ;
9820
9821
int sizei = polyVertexCount * PGL .SIZEOF_INT ;
9821
9822
if (bufObjStreaming ) {
9822
9823
if (onlymap ) {
9823
- polyEmissiveBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asIntBuffer ();
9824
+ polyEmissiveBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asIntBuffer ();
9824
9825
} else {
9825
9826
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 ();
9827
9828
updatePolyEmissiveBuffer ();
9828
9829
}
9829
9830
if (unmap ) {
@@ -9867,18 +9868,18 @@ protected void copyPolyEmissive(int offset, int size) {
9867
9868
}
9868
9869
9869
9870
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 ();
9871
9872
}
9872
9873
9873
9874
protected void initPolyShininessBuffer (boolean onlymap , boolean unmap , int usage ) {
9874
9875
PGL pgl = pg .pgl ;
9875
9876
int sizei = polyVertexCount * PGL .SIZEOF_FLOAT ;
9876
9877
if (bufObjStreaming ) {
9877
9878
if (onlymap ) {
9878
- polyShininessBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .WRITE_ONLY ).asFloatBuffer ();
9879
+ polyShininessBuffer = pgl .mapBuffer (PGL .ARRAY_BUFFER , PGL .glBufferAccess ).asFloatBuffer ();
9879
9880
} else {
9880
9881
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 ();
9882
9883
updatePolyShininessBuffer ();
9883
9884
}
9884
9885
if (unmap ) {
@@ -9923,11 +9924,11 @@ protected void copyPolyShininess(int offset, int size) {
9923
9924
9924
9925
protected void mapPolyAttribBuffer (VertexAttribute attrib ) {
9925
9926
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 ());
9927
9928
} 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 ());
9929
9930
} 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 ));
9931
9932
}
9932
9933
}
9933
9934
@@ -9985,7 +9986,7 @@ protected void copyPolyAttribs(VertexAttribute attrib, int offset, int size) {
9985
9986
}
9986
9987
9987
9988
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 ();
9989
9990
}
9990
9991
9991
9992
protected void initPolyIndicesBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10021,7 +10022,7 @@ protected void copyPolyIndices(int usage) {
10021
10022
}
10022
10023
10023
10024
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 ();
10025
10026
}
10026
10027
10027
10028
protected void initLineVerticesBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10076,7 +10077,7 @@ protected void copyLineVertices(int offset, int size) {
10076
10077
}
10077
10078
10078
10079
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 ();
10080
10081
}
10081
10082
10082
10083
protected void initLineColorsBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10131,7 +10132,7 @@ protected void copyLineColors(int offset, int size) {
10131
10132
}
10132
10133
10133
10134
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 ();
10135
10136
}
10136
10137
10137
10138
protected void initLineDirectionsBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10186,7 +10187,7 @@ protected void copyLineDirections(int offset, int size) {
10186
10187
}
10187
10188
10188
10189
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 ();
10190
10191
}
10191
10192
10192
10193
protected void initLineIndicesBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10222,7 +10223,7 @@ protected void copyLineIndices(int usage) {
10222
10223
}
10223
10224
10224
10225
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 ();
10226
10227
}
10227
10228
10228
10229
protected void initPointVerticesBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10277,7 +10278,7 @@ protected void copyPointVertices(int offset, int size) {
10277
10278
}
10278
10279
10279
10280
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 ();
10281
10282
}
10282
10283
10283
10284
protected void initPointColorsBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10332,7 +10333,7 @@ protected void copyPointColors(int offset, int size) {
10332
10333
}
10333
10334
10334
10335
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 ();
10336
10337
}
10337
10338
10338
10339
protected void initPointOffsetsBuffer (boolean onlymap , boolean unmap , int usage ) {
@@ -10387,7 +10388,7 @@ protected void copyPointOffsets(int offset, int size) {
10387
10388
}
10388
10389
10389
10390
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 ();
10391
10392
}
10392
10393
10393
10394
protected void initPointIndicesBuffer (boolean onlymap , boolean unmap , int usage ) {
0 commit comments