@@ -629,9 +629,9 @@ public void dispose() { // PGraphics
629629 pgl .swapBuffers ();
630630 }
631631
632- deletePolyBuffers ();
633- deleteLineBuffers ();
634- deletePointBuffers ();
632+ finalizePolyBuffers ();
633+ finalizeLineBuffers ();
634+ finalizePointBuffers ();
635635
636636 deleteSurfaceTextures ();
637637 if (primarySurface ) {
@@ -1378,76 +1378,53 @@ protected boolean polyBuffersContextIsOutdated() {
13781378 }
13791379
13801380
1381- protected void deletePolyBuffers () {
1382- if (polyBuffersCreated ) {
1383- deleteVertexBufferObject (glPolyVertex , polyBuffersContext , pgl );
1384- glPolyVertex = 0 ;
1385-
1386- deleteVertexBufferObject (glPolyColor , polyBuffersContext , pgl );
1387- glPolyColor = 0 ;
1388-
1389- deleteVertexBufferObject (glPolyNormal , polyBuffersContext , pgl );
1390- glPolyNormal = 0 ;
1391-
1392- deleteVertexBufferObject (glPolyTexcoord , polyBuffersContext , pgl );
1393- glPolyTexcoord = 0 ;
1394-
1395- deleteVertexBufferObject (glPolyAmbient , polyBuffersContext , pgl );
1396- glPolyAmbient = 0 ;
1397-
1398- deleteVertexBufferObject (glPolySpecular , polyBuffersContext , pgl );
1399- glPolySpecular = 0 ;
1400-
1401- deleteVertexBufferObject (glPolyEmissive , polyBuffersContext , pgl );
1402- glPolyEmissive = 0 ;
1403-
1404- deleteVertexBufferObject (glPolyShininess , polyBuffersContext , pgl );
1405- glPolyShininess = 0 ;
1406-
1407- deleteVertexBufferObject (glPolyIndex , polyBuffersContext , pgl );
1408- glPolyIndex = 0 ;
1409-
1410- polyBuffersCreated = false ;
1411- }
1412- }
1413-
1414-
14151381 protected void finalizePolyBuffers () {
14161382 if (glPolyVertex != 0 ) {
14171383 PGraphicsOpenGL .finalizeVertexBufferObject (glPolyVertex , polyBuffersContext );
1384+ glPolyVertex = 0 ;
14181385 }
14191386
14201387 if (glPolyColor != 0 ) {
14211388 PGraphicsOpenGL .finalizeVertexBufferObject (glPolyColor , polyBuffersContext );
1389+ glPolyColor = 0 ;
14221390 }
14231391
14241392 if (glPolyNormal != 0 ) {
14251393 PGraphicsOpenGL .finalizeVertexBufferObject (glPolyNormal , polyBuffersContext );
1394+ glPolyNormal = 0 ;
14261395 }
14271396
14281397 if (glPolyTexcoord != 0 ) {
14291398 PGraphicsOpenGL .finalizeVertexBufferObject (glPolyTexcoord , polyBuffersContext );
1399+ glPolyTexcoord = 0 ;
14301400 }
14311401
14321402 if (glPolyAmbient != 0 ) {
14331403 PGraphicsOpenGL .finalizeVertexBufferObject (glPolyAmbient , polyBuffersContext );
1404+ glPolyAmbient = 0 ;
14341405 }
14351406
14361407 if (glPolySpecular != 0 ) {
14371408 PGraphicsOpenGL .finalizeVertexBufferObject (glPolySpecular , polyBuffersContext );
1409+ glPolySpecular = 0 ;
14381410 }
14391411
14401412 if (glPolyEmissive != 0 ) {
14411413 PGraphicsOpenGL .finalizeVertexBufferObject (glPolyEmissive , polyBuffersContext );
1414+ glPolyEmissive = 0 ;
14421415 }
14431416
14441417 if (glPolyShininess != 0 ) {
14451418 PGraphicsOpenGL .finalizeVertexBufferObject (glPolyShininess , polyBuffersContext );
1419+ glPolyShininess = 0 ;
14461420 }
14471421
14481422 if (glPolyIndex != 0 ) {
14491423 PGraphicsOpenGL .finalizeVertexBufferObject (glPolyIndex , polyBuffersContext );
1424+ glPolyIndex = 0 ;
14501425 }
1426+
1427+ polyBuffersCreated = false ;
14511428 }
14521429
14531430
@@ -1526,41 +1503,28 @@ protected boolean lineBufferContextIsOutdated() {
15261503 }
15271504
15281505
1529- protected void deleteLineBuffers () {
1530- if (lineBuffersCreated ) {
1531- deleteVertexBufferObject (glLineVertex , lineBuffersContext , pgl );
1532- glLineVertex = 0 ;
1533-
1534- deleteVertexBufferObject (glLineColor , lineBuffersContext , pgl );
1535- glLineColor = 0 ;
1536-
1537- deleteVertexBufferObject (glLineAttrib , lineBuffersContext , pgl );
1538- glLineAttrib = 0 ;
1539-
1540- deleteVertexBufferObject (glLineIndex , lineBuffersContext , pgl );
1541- glLineIndex = 0 ;
1542-
1543- lineBuffersCreated = false ;
1544- }
1545- }
1546-
1547-
15481506 protected void finalizeLineBuffers () {
15491507 if (glLineVertex != 0 ) {
15501508 PGraphicsOpenGL .finalizeVertexBufferObject (glLineVertex , lineBuffersContext );
1509+ glLineVertex = 0 ;
15511510 }
15521511
15531512 if (glLineColor != 0 ) {
15541513 PGraphicsOpenGL .finalizeVertexBufferObject (glLineColor , lineBuffersContext );
1514+ glLineColor = 0 ;
15551515 }
15561516
15571517 if (glLineAttrib != 0 ) {
15581518 PGraphicsOpenGL .finalizeVertexBufferObject (glLineAttrib , lineBuffersContext );
1519+ glLineAttrib = 0 ;
15591520 }
15601521
15611522 if (glLineIndex != 0 ) {
15621523 PGraphicsOpenGL .finalizeVertexBufferObject (glLineIndex , lineBuffersContext );
1524+ glLineIndex = 0 ;
15631525 }
1526+
1527+ lineBuffersCreated = false ;
15641528 }
15651529
15661530
@@ -1638,41 +1602,28 @@ protected boolean pointBuffersContextIsOutdated() {
16381602 }
16391603
16401604
1641- protected void deletePointBuffers () {
1642- if (pointBuffersCreated ) {
1643- deleteVertexBufferObject (glPointVertex , pointBuffersContext , pgl );
1644- glPointVertex = 0 ;
1645-
1646- deleteVertexBufferObject (glPointColor , pointBuffersContext , pgl );
1647- glPointColor = 0 ;
1648-
1649- deleteVertexBufferObject (glPointAttrib , pointBuffersContext , pgl );
1650- glPointAttrib = 0 ;
1651-
1652- deleteVertexBufferObject (glPointIndex , pointBuffersContext , pgl );
1653- glPointIndex = 0 ;
1654-
1655- pointBuffersCreated = false ;
1656- }
1657- }
1658-
1659-
16601605 protected void finalizePointBuffers () {
16611606 if (glPointVertex != 0 ) {
16621607 PGraphicsOpenGL .finalizeVertexBufferObject (glPointVertex , pointBuffersContext );
1608+ glPointVertex = 0 ;
16631609 }
16641610
16651611 if (glPointColor != 0 ) {
16661612 PGraphicsOpenGL .finalizeVertexBufferObject (glPointColor , pointBuffersContext );
1613+ glPointColor = 0 ;
16671614 }
16681615
16691616 if (glPointAttrib != 0 ) {
16701617 PGraphicsOpenGL .finalizeVertexBufferObject (glPointAttrib , pointBuffersContext );
1618+ glPointAttrib = 0 ;
16711619 }
16721620
16731621 if (glPointIndex != 0 ) {
16741622 PGraphicsOpenGL .finalizeVertexBufferObject (glPointIndex , pointBuffersContext );
1623+ glPointIndex = 0 ;
16751624 }
1625+
1626+ pointBuffersCreated = false ;
16761627 }
16771628
16781629
0 commit comments