@@ -575,6 +575,9 @@ public PGraphicsOpenGL() {
575575
576576 viewport = PGL .allocateIntBuffer (4 );
577577
578+ PGL .glUsageRetained = PGL .DYNAMIC_DRAW ;
579+ PGL .glUsageImmediate = PGL .STATIC_DRAW ;
580+
578581 polyAttribs = newAttributeMap ();
579582 inGeo = newInGeometry (this , polyAttribs , IMMEDIATE );
580583 tessGeo = newTessGeometry (this , polyAttribs , IMMEDIATE ,
@@ -1222,48 +1225,46 @@ protected void createPolyBuffers(int usage) {
12221225
12231226 protected void updatePolyBuffers (boolean lit , boolean tex ,
12241227 boolean needNormals , boolean needTexCoords ) {
1225- int glBufferUsage = PGL .STATIC_DRAW ;
1226-
1227- createPolyBuffers (glBufferUsage );
1228+ createPolyBuffers (PGL .glUsageImmediate );
12281229
12291230 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufPolyVertex .glId );
1230- tessGeo .copyPolyVertices (glBufferUsage );
1231+ tessGeo .copyPolyVertices (PGL . glUsageImmediate );
12311232
12321233 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufPolyColor .glId );
1233- tessGeo .copyPolyColors (glBufferUsage );
1234+ tessGeo .copyPolyColors (PGL . glUsageImmediate );
12341235
12351236 if (lit ) {
12361237 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufPolyAmbient .glId );
1237- tessGeo .copyPolyAmbient (glBufferUsage );
1238+ tessGeo .copyPolyAmbient (PGL . glUsageImmediate );
12381239
12391240 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufPolySpecular .glId );
1240- tessGeo .copyPolySpecular (glBufferUsage );
1241+ tessGeo .copyPolySpecular (PGL . glUsageImmediate );
12411242
12421243 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufPolyEmissive .glId );
1243- tessGeo .copyPolyEmissive (glBufferUsage );
1244+ tessGeo .copyPolyEmissive (PGL . glUsageImmediate );
12441245
12451246 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufPolyShininess .glId );
1246- tessGeo .copyPolyShininess (glBufferUsage );
1247+ tessGeo .copyPolyShininess (PGL . glUsageImmediate );
12471248 }
12481249
12491250 if (lit || needNormals ) {
12501251 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufPolyNormal .glId );
1251- tessGeo .copyPolyNormals (glBufferUsage );
1252+ tessGeo .copyPolyNormals (PGL . glUsageImmediate );
12521253 }
12531254
12541255 if (tex || needTexCoords ) {
12551256 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufPolyTexcoord .glId );
1256- tessGeo .copyPolyTexCoords (glBufferUsage );
1257+ tessGeo .copyPolyTexCoords (PGL . glUsageImmediate );
12571258 }
12581259
12591260 for (String name : polyAttribs .keySet ()) {
12601261 VertexAttribute attrib = polyAttribs .get (name );
12611262 pgl .bindBuffer (PGL .ARRAY_BUFFER , attrib .buf .glId );
1262- tessGeo .copyPolyAttribs (attrib , glBufferUsage );
1263+ tessGeo .copyPolyAttribs (attrib , PGL . glUsageImmediate );
12631264 }
12641265
12651266 pgl .bindBuffer (PGL .ELEMENT_ARRAY_BUFFER , bufPolyIndex .glId );
1266- tessGeo .copyPolyIndices (glBufferUsage );
1267+ tessGeo .copyPolyIndices (PGL . glUsageImmediate );
12671268 }
12681269
12691270
@@ -1295,21 +1296,19 @@ protected void createLineBuffers(int usage) {
12951296
12961297
12971298 protected void updateLineBuffers () {
1298- int glBufferUsage = PGL .STATIC_DRAW ;
1299-
1300- createLineBuffers (glBufferUsage );
1299+ createLineBuffers (PGL .glUsageImmediate );
13011300
13021301 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufLineVertex .glId );
1303- tessGeo .copyLineVertices (glBufferUsage );
1302+ tessGeo .copyLineVertices (PGL . glUsageImmediate );
13041303
13051304 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufLineColor .glId );
1306- tessGeo .copyLineColors (glBufferUsage );
1305+ tessGeo .copyLineColors (PGL . glUsageImmediate );
13071306
13081307 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufLineAttrib .glId );
1309- tessGeo .copyLineDirections (glBufferUsage );
1308+ tessGeo .copyLineDirections (PGL . glUsageImmediate );
13101309
13111310 pgl .bindBuffer (PGL .ELEMENT_ARRAY_BUFFER , bufLineIndex .glId );
1312- tessGeo .copyLineIndices (glBufferUsage );
1311+ tessGeo .copyLineIndices (PGL . glUsageImmediate );
13131312 }
13141313
13151314
@@ -1341,21 +1340,19 @@ protected void createPointBuffers(int usage) {
13411340
13421341
13431342 protected void updatePointBuffers () {
1344- int glBufferUsage = PGL .STATIC_DRAW ;
1345-
1346- createPointBuffers (glBufferUsage );
1343+ createPointBuffers (PGL .glUsageImmediate );
13471344
13481345 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufPointVertex .glId );
1349- tessGeo .copyPointVertices (glBufferUsage );
1346+ tessGeo .copyPointVertices (PGL . glUsageImmediate );
13501347
13511348 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufPointColor .glId );
1352- tessGeo .copyPointColors (glBufferUsage );
1349+ tessGeo .copyPointColors (PGL . glUsageImmediate );
13531350
13541351 pgl .bindBuffer (PGL .ARRAY_BUFFER , bufPointAttrib .glId );
1355- tessGeo .copyPointOffsets (glBufferUsage );
1352+ tessGeo .copyPointOffsets (PGL . glUsageImmediate );
13561353
13571354 pgl .bindBuffer (PGL .ELEMENT_ARRAY_BUFFER , bufPointIndex .glId );
1358- tessGeo .copyPointIndices (glBufferUsage );
1355+ tessGeo .copyPointIndices (PGL . glUsageImmediate );
13591356 }
13601357
13611358
@@ -2063,7 +2060,7 @@ protected VertexAttribute attribImpl(String name, int kind, int type, int size)
20632060 }
20642061 VertexAttribute attrib = polyAttribs .get (name );
20652062 if (attrib == null ) {
2066- attrib = new VertexAttribute (this , name , kind , type , size , PGL .STATIC_DRAW );
2063+ attrib = new VertexAttribute (this , name , kind , type , size , PGL .glUsageImmediate );
20672064 polyAttribs .put (name , attrib );
20682065 inGeo .initAttrib (attrib );
20692066 tessGeo .initAttrib (attrib );
0 commit comments